:root {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: rgba(255, 255, 255, 0.11);
  --surface-strong: rgba(7, 11, 23, 0.72);
  --surface-soft: rgba(255, 255, 255, 0.07);
  --ink: #f7f9ff;
  --muted: #aab3cf;
  --line: rgba(255, 255, 255, 0.14);
  --accent: #6ee7b7;
  --accent-2: #93c5fd;
  --accent-ink: #061014;
  --danger: #fca5a5;
  --success: #86efac;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f8f3;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-soft: #edf3ea;
  --ink: #0b1f17;
  --muted: #52645b;
  --line: #d6e2d3;
  --accent: #0f3d2e;
  --accent-2: #1f6b4d;
  --accent-ink: #ffffff;
  --shadow: 0 24px 70px rgba(15, 61, 46, 0.12);
}

* { box-sizing: border-box; }
html { max-width: 100%; overflow-x: hidden; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: radial-gradient(circle at 20% 10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 28%), radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 30%), var(--bg);
}
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(to bottom, black, transparent 78%); }
button, input, textarea, select { font: inherit; }
[hidden] { display: none !important; }
button, select, input, textarea { border: 1px solid var(--line); }
button { cursor: pointer; }
a { color: inherit; }

.app-shell { position: relative; z-index: 1; width: min(1240px, calc(100% - 32px)); margin: 0 auto; padding: clamp(22px, 5vw, 56px) 0; }
.app-shell > *, .hero > *, .content-section > *, .modal-form > *, .action-card, .report-option { min-width: 0; }
.hero, .content-section, dialog { border: 1px solid var(--line); background: var(--surface); border-radius: 28px; box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 24px; padding: clamp(24px, 5vw, 48px); }
.brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 26px; font-weight: 850; letter-spacing: -.035em; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; color: var(--accent-ink); font-weight: 950; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 14px 36px color-mix(in srgb, var(--accent) 28%, transparent); }
.eyebrow { width: fit-content; display: inline-flex; align-items: center; gap: 9px; margin: 0 0 14px; padding: 8px 12px; color: var(--accent); font-size: .76rem; font-weight: 850; text-transform: uppercase; letter-spacing: .13em; background: color-mix(in srgb, var(--accent) 11%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 999px; }
.pulse { width: 8px; height: 8px; background: var(--accent); border-radius: 999px; box-shadow: 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); animation: pulse 1.9s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { max-width: 840px; margin-bottom: 16px; font-size: clamp(3rem, 8vw, 6.4rem); line-height: .9; letter-spacing: -.085em; }
h2 { margin-bottom: 0; font-size: clamp(1.5rem, 4vw, 2.3rem); letter-spacing: -.04em; }
h4 { margin: 14px 0 8px; }
.subhead { max-width: 720px; margin-bottom: 0; color: var(--muted); font-size: 1.08rem; line-height: 1.68; }
.hero-panel { display: grid; gap: 14px; align-content: start; }
.theme-toggle, .button { border-radius: 999px; padding: 12px 16px; background: var(--surface-soft); color: var(--ink); font-weight: 850; white-space: nowrap; text-decoration: none; display: inline-flex; justify-content: center; align-items: center; }
.metric-grid { display: grid; gap: 12px; }
.metric-grid article { padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-soft); }
.metric-grid span { display: block; margin-bottom: 8px; color: var(--muted); font-size: .82rem; font-weight: 750; }
.metric-grid strong { font-size: 2.1rem; letter-spacing: -.06em; }

.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 14px; margin: 18px 0; }
.action-card { min-height: 190px; display: flex; flex-direction: column; justify-content: space-between; gap: 20px; padding: 22px; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); color: var(--ink); text-align: left; text-decoration: none; overflow-wrap: anywhere; box-shadow: var(--shadow); backdrop-filter: blur(20px); transition: transform .18s ease, border-color .18s ease; }
.action-card:hover, .action-card:focus-visible { transform: translateY(-3px); border-color: var(--accent); outline: none; }
.primary-action, .lookup-link { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; }
.report-action { background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--accent-2) 14%, var(--surface))); }
.card-kicker { color: var(--muted); font-weight: 950; }
.primary-action .card-kicker, .lookup-link .card-kicker { color: color-mix(in srgb, var(--accent-ink) 70%, transparent); }
.action-card strong { display: block; font-size: 1.45rem; letter-spacing: -.03em; }
.action-card small { color: var(--muted); line-height: 1.5; }
.primary-action small, .lookup-link small { color: color-mix(in srgb, var(--accent-ink) 82%, transparent); }

.content-section { margin-top: 18px; padding: clamp(20px, 4vw, 34px); }
.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 18px; }
.section-note, .result-count, .pagination-summary { margin: 0; color: var(--muted); font-weight: 800; line-height: 1.55; }
.record-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.lookup-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.record-card { padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-soft); }
.record-card h3 { margin-bottom: 7px; }
.record-card p, .record-card small, .prep-notes p, .prep-notes li { color: var(--muted); line-height: 1.55; }
.record-card dl, .stats-card dl { display: grid; grid-template-columns: 130px 1fr; gap: 5px 10px; margin: 12px 0 0; }
.record-card ul, .prep-notes ul { margin: 8px 0 0; padding-left: 20px; }
dt { color: var(--muted); font-weight: 850; }
dd { margin: 0; }
.lookup-controls, .activity-filters { display: grid; grid-template-columns: 2fr repeat(2, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; align-items: end; }
.lookup-controls-with-action { grid-template-columns: 2fr repeat(2, minmax(150px, 1fr)) auto; }
.lookup-create-button { min-height: 46px; }
.contact-lookup-controls { margin-bottom: 0; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-soft); }
.activity-filters { grid-template-columns: minmax(240px, 2fr) minmax(140px, .95fr) minmax(160px, 1fr) repeat(2, minmax(170px, 1fr)) auto; }
.activity-filters label { min-width: 0; }
.activity-filters input[type="date"] { min-width: 10.75rem; }
#reset-filters { min-height: 48px; padding-inline: 14px; }
.lookup-controls label, .activity-filters label { margin: 0; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-strong); }
.lookup-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.lookup-table th, .lookup-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.lookup-table th { background: var(--surface-soft); color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.sort-button { display: inline-flex; align-items: center; gap: 6px; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.sort-button::after { content: "↕"; color: color-mix(in srgb, var(--muted) 70%, transparent); font-size: .72rem; }
.sort-button[aria-sort="ascending"]::after { content: "↑"; color: var(--accent); }
.sort-button[aria-sort="descending"]::after { content: "↓"; color: var(--accent); }
.sort-button:hover, .sort-button:focus-visible { color: var(--accent); outline: none; }
.activity-table td:nth-child(1), .activity-table td:nth-child(4) { white-space: nowrap; font-weight: 800; color: var(--ink); }
.activity-table td span { color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; background: var(--surface-soft); color: var(--accent); font-size: .82rem; font-weight: 900; white-space: nowrap; }
.empty-state { color: var(--muted); text-align: center; }
.app-state { display: grid; gap: 6px; margin-top: 18px; padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--accent-2) 45%, var(--line)); border-radius: 20px; background: color-mix(in srgb, var(--accent-2) 10%, var(--surface)); box-shadow: var(--shadow); }
.app-state-progress { display: flex; align-items: center; gap: 13px; min-width: 0; }
.app-state-progress > div { display: grid; gap: 4px; min-width: 0; }
.data-loading-indicator { flex: 0 0 auto; width: 25px; height: 25px; border: 3px solid color-mix(in srgb, var(--accent-2) 22%, var(--line)); border-top-color: var(--accent); border-radius: 999px; animation: data-loading-spin .8s linear infinite; }
@keyframes data-loading-spin { to { transform: rotate(360deg); } }
.app-state strong { color: var(--ink); }
.app-state p { margin: 0; color: var(--muted); }
.app-state .button { justify-self: start; width: auto; }

@media (prefers-reduced-motion: reduce) {
  .data-loading-indicator, .pulse { animation: none; }
}


.touchpoint-section { background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface)); }
.touchpoint-section .section-heading { align-items: center; }
.touchpoint-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.touchpoint-actions .section-note { padding: 8px 11px; border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line)); border-radius: 999px; background: color-mix(in srgb, var(--accent) 9%, var(--surface-soft)); color: var(--ink); }
.touchpoint-actions .button { width: auto; min-height: 42px; }
.touchpoint-controls { display: grid; grid-template-columns: minmax(150px, .9fr) minmax(220px, 1.2fr) minmax(300px, 1.45fr) minmax(150px, .75fr); gap: 12px; align-items: end; margin-bottom: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 22px; background: color-mix(in srgb, var(--surface-strong) 76%, var(--surface-soft)); }
.touchpoint-controls label { min-width: 0; margin: 0; }
.segmented-control { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; min-height: 48px; margin: 0; padding: 7px; border: 1px solid color-mix(in srgb, var(--line) 78%, transparent); border-radius: 16px; background: var(--surface-soft); }
.segmented-control legend { padding: 0 6px; color: var(--muted); font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.segmented-control label { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 72px; justify-content: center; min-width: 0; margin: 0; padding: 7px 9px; border-radius: 999px; color: var(--muted); cursor: pointer; }
.segmented-control input { width: auto; margin: 0; accent-color: var(--accent); }
.segmented-control label:has(input:checked) { background: color-mix(in srgb, var(--accent) 14%, var(--surface-strong)); color: var(--accent); }
.touchpoint-dashboard { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .9fr); gap: 16px; align-items: stretch; }
.touchpoint-chart-card, .touchpoint-list-card { display: grid; gap: 14px; min-width: 0; min-height: 390px; padding: 18px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(160deg, var(--surface-strong), color-mix(in srgb, var(--accent-2) 5%, var(--surface-strong))); box-shadow: 0 14px 34px color-mix(in srgb, var(--bg) 16%, transparent); }
.touchpoint-chart-card { grid-template-rows: auto minmax(0, 1fr); }
.touchpoint-list-card { grid-template-rows: auto minmax(0, 1fr); }
.touchpoint-chart-wrap { position: relative; min-width: 0; min-height: 320px; padding: 14px; border: 1px solid color-mix(in srgb, var(--line) 84%, transparent); border-radius: 18px; background: color-mix(in srgb, var(--surface-soft) 88%, transparent); }
.touchpoint-chart-wrap canvas { max-width: 100%; }
.touchpoint-bar-fallback { display: grid; align-content: center; gap: 10px; min-height: 280px; }
.touchpoint-fallback-row { display: grid; grid-template-columns: 78px 1fr; gap: 10px; align-items: center; color: var(--muted); font-weight: 850; }
.touchpoint-fallback-row strong { display: flex; overflow: hidden; width: max(34px, var(--bar-size)); min-height: 30px; padding: 0; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); text-align: right; }
.touchpoint-fallback-row strong span { display: block; width: var(--segment-size); min-width: 4px; background: var(--segment-color); }
.touchpoint-list { display: grid; align-content: start; gap: 8px; margin: 0; padding: 0; list-style: none; }
.touchpoint-list li { display: grid; gap: 4px; padding: 11px 12px; border: 1px solid color-mix(in srgb, var(--line) 82%, transparent); border-radius: 14px; background: var(--surface-soft); transition: border-color .16s ease, transform .16s ease, background .16s ease; }
.touchpoint-list li:has(a:hover), .touchpoint-list li:has(a:focus-visible) { transform: translateX(2px); border-color: color-mix(in srgb, var(--accent) 52%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--surface-soft)); }
.touchpoint-list li > span { color: var(--muted); font-size: .72rem; font-weight: 900; line-height: 1.25; }
.touchpoint-list a { line-height: 1.3; }
.touchpoint-list a strong { display: block; font-size: .9rem; line-height: 1.2; }
.touchpoint-list a small { display: block; margin-top: 2px; font-size: .78rem; line-height: 1.25; }
.touchpoint-list .touchpoint-list-cap { color: var(--muted); font-size: .82rem; font-weight: 800; text-align: center; }
.touchpoint-list-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding-bottom: 2px; border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
.touchpoint-list-heading h3 { margin: 0; }
.touchpoint-list-heading .button { width: auto; padding: 9px 12px; font-size: .88rem; }
.touchpoint-dialog { width: min(1120px, calc(100% - 28px)); }
.touchpoint-table-card { display: grid; gap: 14px; }
.touchpoint-table-card .close { justify-self: end; }
.touchpoint-table-controls { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.touchpoint-table-controls label { margin: 0; }
.touchpoint-table-wrap { max-height: min(520px, 58vh); }
.touchpoint-table td:first-child { min-width: 150px; font-weight: 850; color: var(--muted); }
.touchpoint-table td:nth-child(2) { min-width: 220px; }


.reporting-section { background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--accent-2) 9%, var(--surface))); }
.reporting-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.report-option { min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; padding: 18px; border-radius: 20px; background: var(--surface-strong); color: var(--ink); text-align: left; overflow-wrap: anywhere; transition: transform .18s ease, border-color .18s ease; }
.report-option:hover, .report-option:focus-visible { transform: translateY(-3px); border-color: var(--accent); outline: none; }
.report-option strong { color: var(--accent); font-size: 1.18rem; letter-spacing: -.02em; }
.report-option small { color: var(--muted); line-height: 1.5; }
.custom-report { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; }
.custom-report strong { color: var(--accent-ink); }
.custom-report small { color: color-mix(in srgb, var(--accent-ink) 82%, transparent); }
.report-builder-card { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-strong); }
.report-builder-dialog { width: min(1180px, calc(100% - 28px)); }
.report-download-dialog { width: min(520px, calc(100% - 28px)); }
.report-download-card { gap: 14px; }
.report-builder-dialog .report-builder-card { margin-top: 0; border: 0; }
/* Report-picker menus layer over desktop dialog content so long result lists stay readable. */
@media (min-width: 721px) {
  dialog.report-builder-dialog, dialog.report-download-dialog { overflow: visible; }
  .report-builder-dialog .report-builder-card, .report-download-dialog .report-download-card { overflow: visible; }
  .report-builder-card .custom-control.is-open, .report-download-card .custom-control.is-open { z-index: 1; }
}
.builder-heading { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 12px; }
.builder-heading h3 { margin: 0; font-size: 1.7rem; letter-spacing: -.03em; }
.builder-heading p:last-child { max-width: 560px; margin: 0; color: var(--muted); line-height: 1.55; }
.report-builder-controls { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 12px; align-items: end; }
.report-builder-controls label { margin: 0; }
.report-output { display: grid; gap: 14px; margin-top: 16px; }
.report-snapshot-card { display: grid; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-soft); }
.report-snapshot-header { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.report-snapshot-header p { margin: 6px 0 0; color: var(--muted); }
.report-chart-wrap { min-height: 320px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-strong); }
.report-metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.report-metrics article { padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-strong); }
.report-metrics span { display: block; color: var(--muted); font-size: .78rem; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.report-metrics strong { display: block; margin-top: 6px; font-size: 1.7rem; letter-spacing: -.05em; }
.report-source-table { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 18px; }
.report-source-table table { width: 100%; min-width: 760px; border-collapse: collapse; }
.report-source-table th, .report-source-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.report-source-table th { color: var(--muted); background: var(--surface-strong); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.report-insights { display: grid; gap: 16px; }
.report-insights h4 { margin: 0 0 8px; font-size: 1rem; }
.report-focus-box { padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-strong); box-shadow: var(--shadow); }
.report-focus-box .report-stacked-chart { padding: 18px; }
.report-focus-box .report-stacked-bars { min-height: 340px; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
.report-focus-box .report-stacked-track { min-height: 280px; }
.report-source-table.compact { max-height: 420px; }
.report-source-table.compact table { min-width: 920px; }
.report-source-table.compact th, .report-source-table.compact td { padding: 8px 10px; font-size: .86rem; }
.total-row td { font-weight: 900; background: color-mix(in srgb, var(--accent) 10%, var(--surface-strong)); }

.report-stacked-chart { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-strong); }
.report-stacked-bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 12px; align-items: end; min-height: 260px; padding-top: 8px; }
.report-stacked-bar { display: grid; grid-template-rows: auto 1fr auto; gap: 7px; min-width: 0; height: 100%; align-items: end; text-align: center; }
.report-stacked-total { color: var(--ink); font-size: .82rem; font-weight: 900; }
.report-stacked-track { display: flex; flex-direction: column-reverse; justify-content: flex-start; align-items: stretch; width: 100%; min-height: 210px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px 14px 8px 8px; background: var(--surface-soft); }
.report-stacked-track span { display: grid; place-items: center; min-height: max(10px, var(--segment-height)); background: var(--segment-color); color: #fff; font-size: .72rem; font-weight: 900; }
.report-stacked-track span b { text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.report-stacked-track em { margin: auto; color: var(--muted); font-style: normal; font-weight: 900; }
.report-stacked-label { min-height: 2.4em; color: var(--muted); font-size: .76rem; font-weight: 850; line-height: 1.2; }
.report-stacked-legend { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; color: var(--muted); font-size: .78rem; font-weight: 850; }
.report-stacked-legend span { display: inline-flex; gap: 6px; align-items: center; }
.report-stacked-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--legend-color); }

.button.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; }
.button.secondary { background: var(--surface-soft); color: var(--ink); }
.button.danger { background: #b42318; border-color: #b42318; color: #fff; }
.button.danger:hover, .button.danger:focus-visible { filter: brightness(.94); }
.inline-button { width: auto; margin-top: -4px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.save-status { min-height: 1.2em; align-self: center; color: var(--muted); font-size: .92rem; font-weight: 850; }
.save-status[data-tone="success"] { color: var(--success); }
.save-status[data-tone="pending"] { color: var(--accent-2); }
.save-status[data-tone="error"] { color: var(--danger); }
dialog { width: min(620px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; color: var(--ink); overflow: hidden; }
.wide-dialog { width: min(980px, calc(100% - 28px)); }
dialog::backdrop { background: rgba(7, 17, 13, .62); backdrop-filter: blur(4px); }
.modal-form { max-height: calc(100vh - 28px); padding: 24px; overflow: auto; scrollbar-color: color-mix(in srgb, var(--accent) 46%, var(--surface-soft)) var(--surface-soft); scrollbar-gutter: stable; scrollbar-width: thin; }
.close { float: right; width: 38px; height: 38px; border-radius: 50%; color: var(--ink); background: var(--surface-soft); }
label { display: grid; gap: 8px; margin: 14px 0; color: var(--muted); font-weight: 800; }
.field-help { margin: -6px 0 14px; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.report-filter-help { margin-top: 4px; }

.contact-selector-field { display: grid; gap: 8px; margin: 14px 0; }
.field-label { color: var(--muted); font-weight: 800; }
.contact-selector-list { display: grid; gap: 10px; }
.contact-selector-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.contact-selector-remove { padding-inline: 14px; }
.inline-button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.inline-select-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; margin: 14px 0; }
.inline-select-action label { margin: 0; }
.inline-select-action .inline-button { margin-top: 0; margin-bottom: 0; }
input, textarea, select { width: 100%; border-radius: 16px; padding: 12px; color: var(--ink); background: var(--surface-strong); outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
select[multiple] { min-height: 132px; }
.native-control { position: absolute; width: 1px !important; height: 1px; margin: -1px; padding: 0; border: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; pointer-events: none; white-space: nowrap; }
.custom-control { position: relative; width: 100%; }
.custom-control-trigger { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-strong); color: var(--ink); font: inherit; font-weight: 650; text-align: left; }
.custom-control-trigger::after { content: "⌄"; flex: 0 0 auto; color: var(--accent); font-size: 1.15rem; font-weight: 900; transition: transform .16s ease; }
.custom-control.is-open .custom-control-trigger, .custom-control-trigger:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); outline: none; }
.custom-control.is-open .custom-control-trigger::after { transform: rotate(180deg); }
.custom-control-menu { position: absolute; z-index: 30; display: grid; gap: 7px; width: 100%; max-height: min(340px, 48vh); margin-top: 7px; padding: 7px; overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-strong); box-shadow: var(--shadow); }
.custom-control.opens-upward .custom-control-menu { top: auto; bottom: calc(100% + 7px); margin-top: 0; }
.custom-control-search { position: sticky; top: 0; z-index: 1; padding-bottom: 4px; background: var(--surface-strong); }
.custom-control-search input { min-height: 42px; padding: 9px 11px; border-radius: 12px; }
.custom-control-options { display: grid; gap: 3px; overflow: auto; }
.custom-control-empty { margin: 8px; color: var(--muted); text-align: center; }
.custom-control-option { width: 100%; padding: 10px 11px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--ink); font: inherit; text-align: left; }
.custom-control-option:hover, .custom-control-option:focus-visible, .custom-control-option.is-selected { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); background: color-mix(in srgb, var(--accent) 12%, var(--surface-soft)); color: var(--accent); outline: none; }
.custom-control-option:disabled { cursor: not-allowed; opacity: .45; }
.custom-control-option.is-multiple::before { content: ""; display: inline-block; width: .9rem; height: .9rem; margin-right: 9px; border: 1px solid var(--line); border-radius: 4px; vertical-align: -.13rem; background: var(--surface-strong); }
.custom-control-option.is-multiple.is-selected::before { content: "✓"; border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-size: .7rem; font-weight: 950; line-height: .8rem; text-align: center; }
.custom-date-calendar { width: min(100%, 320px); min-width: 280px; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.custom-date-calendar-header { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; margin-bottom: 4px; }
.custom-date-calendar-header strong { text-align: center; font-size: .9rem; }
.custom-date-jump { display: grid; grid-template-columns: minmax(0, 1fr) 80px; gap: 5px; min-width: 0; }
.custom-date-jump-picker { position: relative; min-width: 0; }
.custom-date-jump-trigger { display: block; width: 100%; overflow: hidden; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface-soft); font: inherit; font-size: .82rem; font-weight: 650; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.custom-date-jump-trigger::after { content: "⌄"; float: right; color: var(--accent); font-weight: 900; }
.custom-date-jump-trigger:focus-visible { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.custom-date-jump-menu { position: absolute; z-index: 4; top: calc(100% + 4px); right: 0; left: 0; display: grid; max-height: 210px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-strong); box-shadow: var(--shadow); }
.custom-date-jump-picker:first-child .custom-date-jump-menu { min-width: 150px; }
.custom-date-jump-option { width: 100%; min-width: 0; padding: 7px 8px; border: 1px solid transparent; border-radius: 8px; color: var(--ink); background: transparent; font: inherit; font-size: .8rem; text-align: left; white-space: nowrap; }
.custom-date-jump-option:hover, .custom-date-jump-option:focus-visible, .custom-date-jump-option.is-selected { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); background: color-mix(in srgb, var(--accent) 12%, var(--surface-soft)); color: var(--accent); outline: none; }
.custom-date-calendar-nav { width: 32px; height: 32px; padding: 0; border-radius: 10px; background: var(--surface-soft); color: var(--ink); }
.custom-date-weekday { padding: 4px 0; color: var(--muted); font-size: .68rem; font-weight: 900; text-align: center; text-transform: uppercase; }
.custom-date-day { aspect-ratio: 1; min-width: 0; padding: 0; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink); font: inherit; font-size: .82rem; }
.custom-date-day:hover, .custom-date-day:focus-visible { border-color: var(--accent); background: var(--surface-soft); outline: none; }
.custom-date-day.is-selected { background: var(--accent); color: var(--accent-ink); font-weight: 900; }
.custom-date-day.is-today { box-shadow: inset 0 0 0 1px var(--accent-2); }
.report-pin-dialog { width: min(440px, calc(100% - 28px)); }
.report-pin-card { position: relative; display: grid; gap: 4px; }
.report-pin-card .close { position: absolute; top: 24px; right: 24px; float: none; }
.report-pin-card label { margin-bottom: 4px; }
.report-pin-card input { letter-spacing: .35em; font-size: 1.25rem; font-weight: 850; text-align: center; }
.report-pin-card .field-help { margin: 0; color: var(--danger); }
textarea { resize: vertical; }
.form-grid { display: grid; gap: 12px; }
.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Purpose: Give the meeting location selector room for long destination names.
   Rationale: Customer types are short labels, while locations often need more visible context.
   Notes: The phone breakpoint returns this row to a single column. */
#meeting-dialog .form-grid.two-up:has(#meeting-customer-type) { grid-template-columns: minmax(150px, .72fr) minmax(0, 1.28fr); }
.prep-notes { margin-top: 16px; }
.prep-layout { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.prep-filter-toggle { width: fit-content; margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--accent-2) 10%, var(--surface-soft)); }
.prep-layout article { padding: 14px; border-radius: 16px; background: color-mix(in srgb, var(--accent-2) 11%, var(--surface-strong)); border: 1px solid color-mix(in srgb, var(--accent-2) 25%, var(--line)); }
.prep-layout article:nth-child(2) { background: color-mix(in srgb, var(--accent) 12%, var(--surface-strong)); border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); }
.prep-layout article:nth-child(3) { background: color-mix(in srgb, var(--accent) 8%, var(--surface-soft)); }
.prep-layout .wide-card { background: color-mix(in srgb, var(--accent-2) 8%, var(--surface-soft)); }
.prep-layout h3 { margin-bottom: 8px; }
.prep-layout h4 { margin-top: 10px; }
.prep-contact-details { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; margin: 10px 0 0; }
.prep-contact-details dd { min-width: 0; overflow-wrap: anywhere; }
.wide-card { grid-column: 1 / -1; }
.prep-meeting-table-wrap { margin-top: 10px; overflow-x: hidden; border-radius: 18px; }
/* Purpose: Keep meeting history fully visible inside the desktop prep workspace.
   Rationale: Fixed proportions and wrapping avoid a marginal horizontal overflow on narrower desktop dialogs.
   Notes: Phone layouts continue to use the responsive record-card presentation. */
.prep-meeting-table { width: 100%; min-width: 0; table-layout: fixed; }
.prep-meeting-table th, .prep-meeting-table td { padding: 12px 14px; overflow-wrap: anywhere; }
.prep-meeting-table th:nth-child(1), .prep-meeting-table td:nth-child(1) { width: 12%; }
.prep-meeting-table th:nth-child(2), .prep-meeting-table td:nth-child(2) { width: 14%; }
.prep-meeting-table th:nth-child(3), .prep-meeting-table td:nth-child(3) { width: 24%; }
.prep-meeting-table th:nth-child(4), .prep-meeting-table td:nth-child(4) { width: 18%; }
.prep-meeting-table th:nth-child(5), .prep-meeting-table td:nth-child(5) { width: 32%; }
.prep-meeting-contacts { min-width: 0; }
.prep-meeting-table .inline-record-link { display: inline-block; max-width: 100%; margin-right: 6px; overflow-wrap: anywhere; vertical-align: top; }
.prep-meeting-table .inline-record-link strong { overflow-wrap: anywhere; white-space: normal; }
.prep-meeting-table .status-pill { display: inline-block; max-width: 100%; overflow-wrap: anywhere; white-space: normal; }
.prep-meeting-details { min-width: 0; max-width: none; }
.record-dialog { width: min(760px, calc(100% - 28px)); }
.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 20px 0; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); }
.related-panel { margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); }
.contact-edit-panel { margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); }
.contact-edit-panel h3 { margin: 0 0 10px; }
.contact-edit-panel .button { width: fit-content; }
.checkbox-field { align-content: center; grid-template-columns: auto 1fr; gap: 10px; color: var(--ink); }
.checkbox-field input { width: auto; }
.related-panel h3 { margin: 0 0 10px; }
.related-panel ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.related-panel li { display: grid; gap: 3px; padding: 12px; border-radius: 14px; background: var(--surface-strong); }
.related-panel span { color: var(--muted); font-size: .92rem; }
.inline-record-link { display: inline-grid; gap: 2px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.company-contact-list-wrap { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; min-width: 0; }
.company-contact-list { display: contents; }
.company-contact-list-expanded { display: contents; }
.company-contact-list .inline-record-link { max-width: 180px; padding: 5px 9px; border: 1px solid color-mix(in srgb, var(--line) 72%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--surface-strong) 68%, transparent); }
.company-contact-list .inline-record-link strong, .company-contact-list .inline-record-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-contact-more { display: contents; }
.company-contact-more summary { width: fit-content; list-style: none; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 999px; padding: 7px 11px; background: color-mix(in srgb, var(--accent) 11%, transparent); color: var(--accent); font-size: .82rem; font-weight: 900; cursor: pointer; }
.company-contact-more summary::-webkit-details-marker { display: none; }
.company-contact-more .company-contact-toggle-hide { display: none; }
.company-contact-more[open] .company-contact-toggle-show { display: none; }
.company-contact-more[open] .company-contact-toggle-hide { display: inline; }
.company-contact-more summary:hover, .company-contact-more summary:focus-visible { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.muted-inline { color: var(--muted); font-size: .92rem; font-weight: 850; white-space: nowrap; }
.inline-record-link strong { color: var(--ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
.inline-record-link:hover strong, .inline-record-link:focus-visible strong { color: var(--accent); text-decoration-color: var(--accent); }
.inline-record-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 10; max-width: min(420px, calc(100% - 40px)); padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-strong); color: var(--ink); box-shadow: var(--shadow); transform: translateY(18px); opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1000px) { .action-grid, .record-grid, .prep-layout, .reporting-grid, .report-metrics, .touchpoint-dashboard { grid-template-columns: repeat(2, 1fr); } .touchpoint-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lookup-controls-with-action { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hero { grid-template-columns: 1fr; } .activity-filters, .report-builder-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Purpose: Keep activity filters inside the card on tablets and small laptops.
   Rationale: The six-column desktop minimums require more width than a 1024 px viewport provides.
   Notes: The existing 720 px breakpoint still stacks the controls into one column. */
@media (max-width: 1100px) { .activity-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .contact-selector-row, .inline-select-action { grid-template-columns: 1fr; } .inline-button-row { display: grid; } .app-shell { width: min(100% - 20px, 1100px); padding: 10px 0 28px; } .hero { border-radius: 22px; } .theme-toggle, .button { width: 100%; text-align: center; } .action-grid, .record-grid, .prep-layout, .two-up, .reporting-grid, .lookup-controls, .activity-filters, .report-builder-controls, .report-metrics, .touchpoint-controls, .touchpoint-dashboard { grid-template-columns: 1fr; } .action-card { min-height: 150px; } .section-heading, .builder-heading, .report-snapshot-header { display: block; } .form-actions { display: grid; } .detail-list { grid-template-columns: 1fr; } }
@media (max-width: 480px) {
  .app-shell { width: min(100% - 14px, 1100px); }
  .hero, .content-section { border-radius: 18px; }
  .hero, .content-section, .modal-form { padding: 16px; }
  .brand { margin-bottom: 18px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 13px; }
  .eyebrow { max-width: 100%; white-space: normal; }
  h1 { font-size: clamp(2.35rem, 16vw, 3.5rem); line-height: .95; }
  h2 { font-size: clamp(1.35rem, 9vw, 1.9rem); }
  .subhead { font-size: 1rem; line-height: 1.55; }
  .action-grid { gap: 10px; margin: 12px 0; }
  .action-card, .report-option, .record-card { border-radius: 18px; padding: 16px; }
  .action-card { min-height: 0; gap: 14px; }
  .action-card strong { font-size: 1.22rem; }
  .section-heading { margin-bottom: 14px; }
  .lookup-table th, .lookup-table td { padding: 12px; }
  .touchpoint-chart-wrap, .report-chart-wrap { min-height: 260px; padding: 8px; }
  .report-stacked-bars { min-height: 220px; gap: 8px; }
  .report-stacked-track { min-height: 170px; }
  dialog, .wide-dialog, .record-dialog, .touchpoint-dialog, .report-builder-dialog, .report-download-dialog, .sales-rep-manager-dialog { width: min(100% - 14px, 100vw); max-height: calc(100dvh - 14px); }
  .modal-form { max-height: calc(100dvh - 14px); }
}

@media (max-width: 720px) {
  #meeting-dialog .form-grid.two-up:has(#meeting-customer-type) { grid-template-columns: 1fr; }
  .hero { padding: 20px; gap: 16px; }
  .hero h1 { font-size: clamp(2.25rem, 13vw, 3.25rem); }
  /* Purpose: Keep the mobile landing actions focused on their destinations.
     Rationale: Supporting descriptions are useful on desktop but repeat information available inside each workspace.
     Notes: These reductions do not affect viewports wider than 720 px. */
  .hero-copy .subhead, .action-card small { display: none; }
  .action-card { min-height: 72px; flex-direction: row; align-items: center; gap: 12px; }
  .action-card .card-kicker { flex: 0 0 auto; font-size: .75rem; }
  .primary-action { box-shadow: 0 16px 38px color-mix(in srgb, var(--accent) 22%, transparent); }
  .touchpoint-section .section-heading { align-items: stretch; }
  .touchpoint-actions { justify-content: flex-start; }
  /* Purpose: Reduce the mobile forecast to its heading, count, and rep filter.
     Rationale: The upcoming-touchpoint cards are too dense to read comfortably on a narrow screen.
     Notes: The full forecast controls and dashboard cards remain unchanged on desktop. */
  .touchpoint-actions .section-note { width: 100%; padding: 0; border: 0; background: transparent; text-align: left; }
  .touchpoint-actions .button, .touchpoint-dashboard { display: none; }
  .touchpoint-controls { margin-bottom: 10px; padding: 0; border: 0; border-radius: 0; background: transparent; }
  .touchpoint-controls > label:has(#touchpoint-start-week),
  .touchpoint-controls > .segmented-control,
  .touchpoint-controls > label:has(#touchpoint-week-count) { display: none; }
  .custom-control-menu { position: fixed; inset: auto 0 0; z-index: 100; width: 100%; max-height: min(72dvh, 580px); margin: 0; padding: 14px max(14px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); border-radius: 24px 24px 0 0; box-shadow: 0 -18px 60px rgba(0, 0, 0, .35); }
  .custom-control.opens-upward .custom-control-menu { top: auto; bottom: 0; }
  .custom-control-menu::before { content: ""; width: 42px; height: 4px; justify-self: center; border-radius: 999px; background: var(--line); }
  .custom-date-calendar::before { grid-column: 1 / -1; }
  .custom-control-options { max-height: 48dvh; overscroll-behavior: contain; }
  .custom-control-option { min-height: 46px; padding: 12px; }
  .custom-date-calendar { width: 100%; min-width: 0; max-height: min(76dvh, 620px); }
  .custom-date-calendar .custom-date-day { min-height: 39px; }
  /* Purpose: Present every mobile card workflow as a separate full-screen area.
     Rationale: An opaque viewport-sized surface removes the visual clutter of the page behind an open card.
     Notes: Desktop and tablet dialog sizing remains unchanged. */
  dialog, .wide-dialog, .record-dialog, .touchpoint-dialog, .report-builder-dialog, .report-download-dialog, .sales-rep-manager-dialog { inset: 0; width: 100%; max-width: none; height: 100dvh; min-height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; background: var(--bg); }
  dialog::backdrop { background: var(--bg); backdrop-filter: none; }
  .modal-form { min-height: 100dvh; max-height: 100dvh; padding: calc(20px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); background: var(--bg); }
  .sales-rep-manager-card > .close { top: 20px; right: 16px; }
  .modal-form > .form-actions:last-child, .modal-form form > .form-actions:last-child { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); z-index: 2; margin-inline: -16px; margin-bottom: calc(-16px - env(safe-area-inset-bottom)); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface-strong); border-top: 1px solid var(--line); }
  /* Purpose: Keep the mobile meeting footer actions on one compact row.
     Rationale: The shared mobile action grid otherwise stacks Cancel and Save meeting vertically.
     Notes: Both actions retain equal width and the shared sticky-footer treatment. */
  #meeting-dialog .form-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Purpose: Keep the mobile PIN challenge centred and visually self-contained.
     Rationale: A full-height implicit grid and the shared sticky footer otherwise stretch its short form into uneven rows.
     Notes: Safe alignment keeps the form scrollable above a small viewport or open software keyboard. */
  #report-pin-dialog { position: fixed; inset: 0; width: 100dvw; min-width: 100dvw; max-width: 100dvw; height: 100dvh; min-height: 100dvh; max-height: 100dvh; overflow: hidden; scrollbar-gutter: auto; }
  #report-pin-form { grid-auto-rows: max-content; align-content: safe center; gap: 10px; width: 100%; min-width: 100%; max-width: 100%; height: 100%; min-height: 100%; max-height: 100%; padding: calc(64px + env(safe-area-inset-top)) max(20px, calc((100dvw - 420px) / 2)) calc(24px + env(safe-area-inset-bottom)); overflow: auto; scrollbar-gutter: auto; background: var(--bg); }
  #report-pin-form .close { top: calc(20px + env(safe-area-inset-top)); right: max(20px, env(safe-area-inset-right)); }
  #report-pin-form .eyebrow { margin-bottom: 2px; }
  #report-pin-form h2, #report-pin-form .subhead { margin-bottom: 0; }
  #report-pin-form label { margin: 8px 0 0; }
  #report-pin-form .form-actions { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); bottom: auto; z-index: auto; margin: 14px 0 0; padding: 0; border-top: 0; background: transparent; }
  /* Purpose: Present weekly and monthly report actions as a tidy inline pair on mobile.
     Rationale: The shared sticky footer adds a contrasting background block that is unnecessary in this short download form.
     Notes: Forward-look reports and all desktop report dialogs retain their existing treatment. */
  #report-download-card:is([data-active-report-preset="weekly"], [data-active-report-preset="monthly"]) > .form-actions:last-child { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); bottom: auto; z-index: auto; margin: 18px 0 0; padding: 0; border-top: 0; background: transparent; }
  /* Purpose: Remove the right-edge scrollbar gutter from protected mobile workspaces.
     Rationale: The shared modal form and a later desktop dialog width can otherwise expose a strip beside the full-window workspace.
     Notes: Scroll remains available by touch, trackpad, and keyboard inside the forms. */
  html:has(#report-pin-dialog[open]), html:has(#sales-rep-manager-dialog[open]),
  body:has(#report-pin-dialog[open]), body:has(#sales-rep-manager-dialog[open]) { overflow: hidden; }
  #sales-rep-manager-dialog { position: fixed; inset: 0; width: 100dvw; min-width: 100dvw; max-width: 100dvw; height: 100dvh; min-height: 100dvh; max-height: 100dvh; overflow: hidden; scrollbar-gutter: auto; }
  .sales-rep-manager-card { width: 100%; min-width: 100%; max-width: 100%; }
  #report-pin-form, .sales-rep-manager-card { overflow-x: hidden; scrollbar-color: auto; scrollbar-gutter: auto; scrollbar-width: none; }
  #report-pin-form::-webkit-scrollbar, .sales-rep-manager-card::-webkit-scrollbar { width: 0; height: 0; }
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  .lookup-table, .lookup-table tbody, .lookup-table tr, .lookup-table td, .report-source-table table, .report-source-table tbody, .report-source-table tr, .report-source-table td { display: block; width: 100%; min-width: 0; }
  .lookup-table thead, .report-source-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .lookup-table tbody, .report-source-table tbody { display: grid; gap: 10px; }
  .lookup-table tbody tr, .report-source-table tbody tr { display: grid; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-strong); }
  .lookup-table td, .report-source-table td { display: grid; grid-template-columns: minmax(96px, .72fr) minmax(0, 1.5fr); gap: 10px; padding: 0; border: 0; text-align: left; }
  .lookup-table td::before, .report-source-table td::before { color: var(--muted); font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
  .lookup-table tbody tr:has(.empty-state), .report-source-table tbody tr:has(.empty-state) { display: block; text-align: center; }
  .lookup-table .empty-state, .report-source-table .empty-state { display: block; }
  .lookup-table-panel:nth-child(1) .lookup-table td:nth-child(1)::before { content: "Company"; } .lookup-table-panel:nth-child(1) .lookup-table td:nth-child(2)::before { content: "Type"; } .lookup-table-panel:nth-child(1) .lookup-table td:nth-child(3)::before { content: "Location"; } .lookup-table-panel:nth-child(1) .lookup-table td:nth-child(4)::before { content: "Priority"; } .lookup-table-panel:nth-child(1) .lookup-table td:nth-child(5)::before { content: "Contacts"; } .lookup-table-panel:nth-child(1) .lookup-table td:nth-child(6)::before { content: "Meetings"; }
  .lookup-table-panel:nth-child(2) .lookup-table td:nth-child(1)::before { content: "Contact"; } .lookup-table-panel:nth-child(2) .lookup-table td:nth-child(2)::before { content: "Title"; } .lookup-table-panel:nth-child(2) .lookup-table td:nth-child(3)::before { content: "Company"; } .lookup-table-panel:nth-child(2) .lookup-table td:nth-child(4)::before { content: "Email"; } .lookup-table-panel:nth-child(2) .lookup-table td:nth-child(5)::before { content: "Phone"; } .lookup-table-panel:nth-child(2) .lookup-table td:nth-child(6)::before { content: "Meetings"; }
  /* Purpose: Show only identity and essential context in mobile company and contact cards.
     Rationale: Full record details remain one tap away in the new full-screen record view.
     Notes: All retained fields share the same label-and-value columns for consistent alignment. */
  .lookup-table-panel .lookup-table tbody tr { gap: 6px; padding: 12px; }
  .lookup-table-panel .lookup-table td:first-child .inline-record-link strong { font-size: 1rem; }
  .lookup-table-panel:nth-child(1) .lookup-table td:nth-child(n+4),
  .lookup-table-panel:nth-child(2) .lookup-table td:nth-child(n+4) { display: none; }
  /* Purpose: Render prep meeting history as readable full-width cards on mobile.
     Rationale: Desktop percentage column widths otherwise survive the table-to-card conversion and create tall, narrow fields.
     Notes: The three most recent meetings remain visible; desktop retains the complete eight-meeting history. */
  .prep-meeting-table.lookup-table tbody tr { gap: 8px; padding: 14px; }
  .prep-meeting-table.lookup-table tbody tr:nth-child(n + 4) { display: none; }
  .prep-meeting-table.lookup-table td { width: 100%; grid-template-columns: minmax(76px, .6fr) minmax(0, 1.7fr); gap: 10px; }
  .prep-meeting-table.lookup-table td:nth-child(1)::before { content: "Date"; }
  .prep-meeting-table.lookup-table td:nth-child(2)::before { content: "Type"; }
  .prep-meeting-table.lookup-table td:nth-child(3)::before { content: "Contacts"; }
  .prep-meeting-table.lookup-table td:nth-child(4)::before { content: "Rep"; }
  .prep-meeting-table.lookup-table td:nth-child(5) { grid-template-columns: 1fr; gap: 5px; margin-top: 3px; padding-top: 10px; border-top: 1px solid var(--line); }
  .prep-meeting-table.lookup-table td:nth-child(5)::before { content: "Details"; }
  .prep-meeting-table.lookup-table tr:has(.empty-state) .empty-state::before { content: none; }
  .activity-table td:nth-child(1)::before { content: "Date"; } .activity-table td:nth-child(2)::before { content: "Customer"; } .activity-table td:nth-child(3)::before { content: "Contacts"; } .activity-table td:nth-child(4)::before { content: "Type"; } .activity-table td:nth-child(5)::before { content: "Rep"; } .activity-table td:nth-child(6)::before { content: "Notes"; }
  .touchpoint-table td:nth-child(1)::before { content: "Week"; } .touchpoint-table td:nth-child(2)::before { content: "Company"; } .touchpoint-table td:nth-child(3)::before { content: "Contacts"; } .touchpoint-table td:nth-child(4)::before { content: "Rep"; } .touchpoint-table td:nth-child(5)::before { content: "Call type"; } .touchpoint-table td:nth-child(6)::before { content: "Location"; }
  .report-source-table { overflow: visible; border: 0; }
  .report-source-table td::before { content: "Detail"; }
}

.lookup-table-stack { display: grid; gap: 18px; }
.lookup-table-panel { display: grid; gap: 12px; }
.table-panel-heading { display: flex; justify-content: space-between; gap: 18px; align-items: end; }
.table-panel-heading h3 { margin-bottom: 0; }
.pagination-controls { display: flex; justify-content: flex-end; align-items: center; gap: 12px; color: var(--muted); font-weight: 850; }
.activity-log-workspace .pagination-controls { margin-top: 16px; }
.pagination-controls .button:disabled { cursor: not-allowed; opacity: .48; }

@media (max-width: 720px) {
  .table-panel-heading { align-items: stretch; flex-direction: column; }
  /* Purpose: Keep mobile pagination compact and easy to scan.
     Rationale: Full-width stacked buttons consume excessive space in the company, contact, and meeting lists.
     Notes: The page count remains above an inline Previous and Next button pair. */
  .pagination-controls { display: grid; grid-template-columns: repeat(2, max-content); justify-content: end; align-items: center; gap: 8px; }
  .pagination-controls > span { grid-column: 1 / -1; grid-row: 1; text-align: right; }
  .pagination-controls .button { grid-row: 2; width: auto; padding: 8px 12px; font-size: .86rem; }
}
.populated-field { display: grid; gap: 8px; min-height: 58px; width: 100%; border: 1px solid var(--line); border-radius: 16px; padding: 12px; color: var(--ink); background: var(--surface-strong); }
.populated-field-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.populated-field-item strong { color: var(--ink); }
.populated-field-item span, .populated-field-empty { color: var(--muted); }

.contact-card-actions, .meeting-card-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin: -6px 0 14px; }
.detail-list.is-editing { align-items: center; }
.detail-list.is-editing dd { min-width: 0; }
.contact-inline-field { min-height: 0; padding: 6px 8px; border-radius: 10px; background: color-mix(in srgb, var(--surface-strong) 78%, transparent); }
#detail-name .contact-inline-field { width: 100%; max-width: 100%; padding: 4px 8px; color: inherit; font: inherit; font-size: inherit; font-weight: inherit; letter-spacing: inherit; line-height: inherit; }
.inline-checkbox { display: inline-flex; width: fit-content; margin: 0; padding: 4px 8px; border: 1px solid color-mix(in srgb, var(--line) 65%, transparent); border-radius: 999px; background: transparent; color: var(--muted); font-size: .88rem; font-weight: 750; }
.inline-checkbox input { width: 13px; height: 13px; margin: 0; accent-color: var(--muted); }
.inline-checkbox span { color: inherit; }
@media (max-width: 720px) { .contact-card-actions, .meeting-card-actions { display: grid; } .detail-list.is-editing { grid-template-columns: 1fr; } }

.existing-location-card { margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); }
.existing-location-card h3 { margin: 0 0 10px; }
.existing-location-card ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.existing-location-card li { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-strong); color: var(--ink); font-weight: 850; }

.company-location-picker { margin-bottom: 8px; }
.company-location-picker .button { min-width: 46px; }
.location-match-card { display: grid; gap: 6px; margin: -2px 0 14px; padding: 12px; border: 1px solid color-mix(in srgb, var(--accent-2) 38%, var(--line)); border-radius: 16px; background: color-mix(in srgb, var(--accent-2) 10%, var(--surface-soft)); color: var(--muted); font-size: .9rem; line-height: 1.45; }
.location-match-card[hidden] { display: none; }
.location-match-card strong { color: var(--ink); }
.location-match-card ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }
.location-match-card li { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-strong); color: var(--ink); font-weight: 800; }

.sales-rep-manager-dialog { width: min(980px, calc(100% - 28px)); }
.sales-rep-manager-card { position: relative; display: grid; gap: 16px; }
.sales-rep-manager-card > .close { position: absolute; top: 24px; right: 24px; float: none; }
.sales-rep-manager-section, .sales-rep-manager-form { padding: 16px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-soft); }
.sales-rep-manager-help { max-width: 620px; margin: 8px 0 0; color: var(--muted); line-height: 1.55; }
.sales-rep-manager-table-wrap { max-height: none; overflow: visible; }
.sales-rep-manager-table td:nth-child(1) { min-width: 180px; }
.sales-rep-manager-table td:nth-child(2) { min-width: 220px; }
.sales-rep-manager-table td:nth-child(5) { width: 1%; white-space: nowrap; }
.sales-rep-manager-form h4 { margin-top: 0; }
.sales-rep-inactivate-button { padding: 9px 12px; }
.hero-panel .button { width: 100%; }
