:root {
  --ink: #18202a;
  --muted: #647080;
  --muted-2: #8893a1;
  --line: #dfe3e8;
  --line-strong: #cbd2da;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef1f4;
  --page: #f2f4f6;
  --sidebar: #1e2732;
  --sidebar-hover: #2a3542;
  --sidebar-active: #354354;
  --accent: #2571d9;
  --accent-hover: #1c5fb9;
  --accent-soft: #eaf2fd;
  --danger: #b42318;
  --danger-soft: #fef0ef;
  --warning: #9a6700;
  --warning-soft: #fff6dc;
  --success: #1e7049;
  --success-soft: #e9f6ef;
  --purple: #6846a5;
  --purple-soft: #f1edfb;
  --shadow: 0 1px 2px rgba(20, 30, 45, .08), 0 8px 30px rgba(20, 30, 45, .06);
  --radius: 7px;
  --sidebar-width: 226px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--page); color: var(--ink); font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar); color: #e7ebf0; display: flex; flex-direction: column; padding: 14px 12px 12px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; padding: 7px 8px 18px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; background: #f6f7f9; color: var(--sidebar); font-weight: 800; font-size: 18px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.brand-copy, .user-copy { display: flex; min-width: 0; flex-direction: column; }
.brand-copy strong { font-size: 15px; letter-spacing: .01em; }
.brand-copy small { color: #aeb8c4; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.nav-list { display: grid; gap: 3px; }
.nav-item { color: #d8dee5; min-height: 39px; display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 7px; padding: 0 9px; border-radius: 6px; font-weight: 600; font-size: 13px; }
.nav-item:hover { background: var(--sidebar-hover); text-decoration: none; color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 #76a9ee; }
.nav-item small { min-width: 19px; height: 18px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #cbd4df; font-size: 10px; }
.nav-icon { width: 22px; height: 22px; border: 1px solid rgba(255,255,255,.16); border-radius: 5px; display: grid; place-items: center; font-size: 10px; color: #aeb8c4; }
.sidebar-spacer { flex: 1; }
.nav-secondary { padding-top: 10px; border-top: 1px solid rgba(255,255,255,.09); }
.user-panel { margin-top: 11px; padding: 11px 7px 4px; border-top: 1px solid rgba(255,255,255,.09); display: grid; grid-template-columns: 31px 1fr auto; align-items: center; gap: 9px; }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: #5a6a7d; color: #fff; font-weight: 700; }
.user-copy strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-copy small { color: #aeb8c4; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-panel form { margin: 0; }

.main-area { min-width: 0; }
.topbar { height: 58px; position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(8px); }
.topbar h1 { margin: 0; font-size: 17px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.environment-chip, .timezone-chip { border: 1px solid var(--line); background: var(--surface-2); padding: 4px 8px; border-radius: 999px; font-size: 11px; color: var(--muted); }
.environment-chip { color: var(--purple); background: var(--purple-soft); border-color: #ddd2f3; font-weight: 700; }
.page-content { padding: 22px 24px 36px; }
.workspace { max-width: 1600px; margin: 0 auto; }
.workspace-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.workspace-heading h2, .detail-header h2, .placeholder-card h2 { margin: 0 0 4px; font-size: 21px; line-height: 1.25; }
.workspace-heading p, .section-header p, .placeholder-card p, .login-heading p { margin: 0; color: var(--muted); }

.button { min-height: 34px; border: 1px solid transparent; border-radius: 5px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-weight: 650; color: var(--ink); background: var(--surface); white-space: nowrap; }
.button:hover { text-decoration: none; }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.subtle { border-color: var(--line-strong); background: var(--surface); }
.button.subtle:hover:not(:disabled) { background: var(--surface-2); }
.button.ghost { background: transparent; color: var(--muted); }
.button.danger { color: var(--danger); }
.button.small { min-height: 29px; padding: 0 10px; font-size: 12px; }
.button.full { width: 100%; }
.icon-button { width: 31px; height: 31px; border: 0; background: transparent; color: inherit; border-radius: 5px; cursor: pointer; display: grid; place-items: center; font-size: 17px; }
.icon-button:hover { background: rgba(255,255,255,.08); }

.status-tabs { display: flex; min-width: 0; overflow-x: auto; border-bottom: 1px solid var(--line-strong); margin-bottom: 13px; }
.status-tab { border: 0; background: transparent; color: var(--muted); padding: 10px 13px 9px; cursor: pointer; border-bottom: 2px solid transparent; font-weight: 650; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.status-tab:hover { color: var(--ink); }
.status-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.status-tab .count { min-width: 23px; height: 19px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 9px; background: var(--surface-3); color: var(--muted); font-size: 11px; }
.status-tab.active .count { background: var(--accent-soft); color: var(--accent); }
.status-tab.overdue-tab { color: var(--danger); }
.status-tab.overdue-tab.active { border-bottom-color: var(--danger); }

.table-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; margin-bottom: 11px; }
.search-control { min-width: 300px; flex: 1 1 380px; height: 36px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 5px; display: flex; align-items: center; gap: 7px; padding: 0 10px; }
.search-control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,113,217,.13); }
.search-control span { color: var(--muted-2); font-size: 18px; }
.search-control input { width: 100%; border: 0; outline: 0; background: transparent; }
.compact-field { display: grid; gap: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.compact-field select { min-width: 142px; height: 36px; color: var(--ink); text-transform: none; letter-spacing: normal; font-weight: 500; }
input, select, textarea { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 5px; padding: 7px 9px; outline: 0; }
input, select { min-height: 35px; }
textarea { resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,113,217,.13); }
label { color: var(--muted); font-size: 12px; font-weight: 650; }
label > input, label > select, label > textarea, label > .input-suffix { width: 100%; display: block; margin-top: 5px; color: var(--ink); font-weight: 400; }
label small { font-weight: 400; color: var(--muted-2); }

.bulk-bar { display: flex; align-items: center; gap: 12px; min-height: 45px; padding: 7px 11px; background: var(--accent-soft); border: 1px solid #cbdff8; border-radius: 6px; margin-bottom: 9px; }
.bulk-bar label { display: flex; align-items: center; gap: 7px; color: var(--ink); }
.bulk-bar select { min-height: 29px; padding-top: 3px; padding-bottom: 3px; }

.table-card, .section-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 1px rgba(20,30,45,.025); }
.table-scroll { overflow: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 1000px; }
.data-table th { height: 37px; padding: 0 11px; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--muted); text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .045em; white-space: nowrap; position: sticky; top: 0; z-index: 2; }
.data-table td { height: 48px; padding: 7px 11px; border-bottom: 1px solid #edf0f3; vertical-align: middle; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr.selected { background: #eef5fe; }
.data-table tbody tr.overdue-row { box-shadow: inset 3px 0 0 #d84a3e; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .numeric { text-align: right; font-variant-numeric: tabular-nums; }
.checkbox-cell { width: 36px; text-align: center !important; padding-left: 10px !important; padding-right: 4px !important; }
.checkbox-cell input { min-height: auto; width: 15px; height: 15px; }
.sort-button { border: 0; background: transparent; color: inherit; text-transform: inherit; letter-spacing: inherit; font-weight: inherit; padding: 0; cursor: pointer; }
.sort-button.active { color: var(--ink); }
.sort-button span { font-size: 10px; }
.dealer-cell { min-width: 200px; }
.dealer-cell strong, .contact-cell strong { display: block; color: var(--ink); font-size: 13px; }
.dealer-cell small, .contact-cell small, .cell-subtext { display: block; color: var(--muted); font-size: 11px; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.due-cell.overdue { color: var(--danger); font-weight: 700; }
.owner-cell { white-space: nowrap; }
.owner-dot { width: 21px; height: 21px; border-radius: 50%; background: var(--surface-3); display: inline-grid; place-items: center; margin-right: 5px; color: var(--muted); font-size: 10px; font-weight: 800; }
.status-badge, .connection-pill, .scope-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-badge.active { color: var(--success); background: var(--success-soft); }
.status-badge.dormant { color: var(--warning); background: var(--warning-soft); }
.status-badge.self_service { color: #516071; background: #edf0f3; }
.status-badge.prospect { color: var(--accent); background: var(--accent-soft); }
.status-badge.prospect_pool { color: var(--purple); background: var(--purple-soft); }
.status-badge.archive { color: #69727d; background: #f0f1f3; }
.connection-cell { color: var(--muted); font-size: 12px; }
.connection-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--muted-2); margin-right: 6px; }
.connection-dot.connected { background: #3d9b68; }
.table-footer { min-height: 49px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 11px; color: var(--muted); font-size: 12px; }
.pagination { display: flex; align-items: center; gap: 10px; }
.table-empty, .inline-empty { padding: 38px 20px; text-align: center; color: var(--muted); }
.table-empty strong, .table-empty span { display: block; }
.table-empty strong { color: var(--ink); margin-bottom: 3px; }
.inline-empty { padding: 22px; border: 1px dashed var(--line-strong); border-radius: 5px; }
.skeleton-row td { background: linear-gradient(90deg, #f6f7f8, #eceff2, #f6f7f8); background-size: 220% 100%; animation: shimmer 1.25s infinite; color: transparent; }
@keyframes shimmer { to { background-position: -220% 0; } }

.breadcrumb-row { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.title-line { display: flex; align-items: center; gap: 9px; }
.source-line { color: var(--muted); font-size: 12px; }
.source-line .override-note { color: var(--warning); }
.scope-badge { color: #4d5967; background: var(--surface-3); }
.header-actions { display: flex; gap: 8px; }
.identity-strip { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(4, minmax(140px, 1fr)); gap: 10px; padding: 13px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.identity-strip .grow { min-width: 0; }
.identity-strip small { display: block; margin-top: 3px; font-size: 10px; }
.section-form[data-dirty="true"] { box-shadow: inset 3px 0 0 var(--warning); }
.metrics-grid { display: grid; grid-template-columns: repeat(6, minmax(125px, 1fr)); gap: 8px; margin-bottom: 12px; }
.metric { min-height: 74px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 11px; }
.metric span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .045em; font-weight: 700; }
.metric strong { display: block; margin-top: 6px; font-size: 17px; font-variant-numeric: tabular-nums; }
.metric small { display: block; color: var(--muted); margin-top: 1px; font-size: 10px; }
.metric.alert strong { color: var(--danger); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, .86fr); gap: 12px; align-items: start; }
.detail-main, .detail-aside { display: grid; gap: 12px; min-width: 0; }
.section-card { padding: 0; overflow: hidden; }
.section-header { min-height: 57px; padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-header h3 { margin: 0 0 2px; font-size: 14px; }
.section-header p { font-size: 11px; }
.section-actions, .button-row { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.section-card > .section-form { padding: 14px; }
.compact-card .section-header { align-items: flex-start; }
.contact-list { display: grid; }
.contact-row { display: grid; grid-template-columns: minmax(190px, 1.4fr) minmax(190px, 1.2fr) minmax(160px, 1fr) auto; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid #edf0f3; }
.contact-row:last-child { border-bottom: 0; }
.contact-name strong { display: block; }
.contact-name small, .contact-detail small { color: var(--muted); display: block; }
.contact-roles { display: flex; gap: 5px; flex-wrap: wrap; }
.role-chip { border-radius: 999px; background: var(--surface-3); color: var(--muted); padding: 2px 7px; font-size: 10px; font-weight: 700; }
.row-actions { display: flex; gap: 4px; }
.row-actions button { border: 1px solid var(--line); background: var(--surface); border-radius: 4px; padding: 4px 7px; cursor: pointer; font-size: 11px; color: var(--muted); }
.row-actions button:hover { color: var(--ink); background: var(--surface-2); }
.row-actions button.delete:hover { color: var(--danger); }
.address-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.address-card { padding: 14px; min-height: 178px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.address-card:nth-child(2n) { border-right: 0; }
.address-card:nth-last-child(-n+2) { border-bottom: 0; }
.address-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; }
.address-card-header strong { font-size: 12px; }
.source-chip { font-size: 9px; padding: 2px 6px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; font-weight: 800; color: var(--success); background: var(--success-soft); }
.source-chip.override { color: var(--warning); background: var(--warning-soft); }
.address-lines { min-height: 88px; color: var(--ink); }
.address-lines span { display: block; }
.address-source-note { color: var(--muted); font-size: 10px; margin-top: 7px; }
.address-card footer { margin-top: 10px; display: flex; gap: 6px; }
.key-value-list { margin: 0; padding: 5px 14px 13px; }
.key-value-list > div { min-height: 37px; display: grid; grid-template-columns: 42% 58%; align-items: center; gap: 10px; border-bottom: 1px solid #edf0f3; }
.key-value-list > div:last-child { border-bottom: 0; }
.key-value-list dt { color: var(--muted); font-size: 11px; }
.key-value-list dd { margin: 0; text-align: right; font-size: 11px; overflow-wrap: anywhere; }
.compact-card > .button-row { padding: 0 14px 14px; }
.connection-pill.healthy { color: var(--success); background: var(--success-soft); }
.connection-pill.not_connected { color: var(--muted); background: var(--surface-3); }
.connection-pill.running { color: var(--accent); background: var(--accent-soft); }
.connection-pill.error { color: var(--danger); background: var(--danger-soft); }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; padding: 12px 14px 8px; gap: 0; }
.segmented-control button { min-height: 34px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; }
.segmented-control button:first-child { border-radius: 5px 0 0 5px; }
.segmented-control button:last-child { border-radius: 0 5px 5px 0; border-left: 0; }
.segmented-control button.active { background: var(--accent-soft); color: var(--accent); border-color: #b7d2f5; font-weight: 700; }
.structural-note { margin: 0 14px 10px; padding: 9px; color: var(--muted); background: var(--surface-2); border-radius: 5px; font-size: 10px; }
.location-list { max-height: 250px; overflow: auto; border-top: 1px solid var(--line); }
.location-row { padding: 8px 14px; border-bottom: 1px solid #edf0f3; display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.location-row:last-child { border-bottom: 0; }
.location-row span { color: var(--muted); }
.detail-loading { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal { width: min(640px, calc(100vw - 30px)); max-height: calc(100vh - 34px); padding: 0; border: 0; border-radius: 9px; box-shadow: var(--shadow); color: var(--ink); }
.modal::backdrop { background: rgba(20, 28, 38, .48); backdrop-filter: blur(1px); }
.modal-shell { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.modal-shell > header { min-height: 68px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.modal-shell > header h2 { margin: 0 0 3px; font-size: 17px; }
.modal-shell > header p { margin: 0; color: var(--muted); font-size: 11px; }
.modal-shell .modal-close:hover { background: var(--surface-3); }
.modal-body { overflow-y: auto; padding: 16px 17px; }
.modal-shell > footer { min-height: 59px; padding: 11px 17px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.footer-spacer { flex: 1; }
.form-grid { display: grid; gap: 12px; }
.form-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.form-section-title { color: var(--ink); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding-top: 3px; }
.role-fieldset { border: 1px solid var(--line); border-radius: 5px; display: flex; align-items: center; gap: 18px; padding: 8px 10px 10px; }
.role-fieldset legend { padding: 0 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.role-fieldset label { display: flex; align-items: center; gap: 5px; color: var(--ink); font-weight: 500; }
.role-fieldset input { width: 15px; height: 15px; min-height: auto; margin: 0; }
.phone-editor { display: grid; gap: 8px; }
.phone-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 7px; margin-bottom: 7px; }
.phone-row .remove-phone { width: 34px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--danger); cursor: pointer; }

.alert { border: 1px solid var(--line); border-radius: 5px; padding: 9px 11px; font-size: 12px; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f3c7c3; }
.alert-warning { background: var(--warning-soft); color: #765000; border-color: #efd997; }
.alert-info { background: var(--accent-soft); color: #24578f; border-color: #c7dcf7; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); }
.toast { background: #202a35; color: #fff; border-radius: 6px; padding: 11px 13px; box-shadow: var(--shadow); display: flex; justify-content: space-between; gap: 12px; animation: toast-in .18s ease-out; }
.toast.error { background: #7f251f; }
.toast.success { background: #205f42; }
.toast button { color: inherit; border: 0; background: transparent; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.settings-grid .section-card { min-width: 0; }
.span-2-card { grid-column: span 2; }
.input-suffix { display: grid !important; grid-template-columns: 1fr auto; border: 1px solid var(--line-strong); border-radius: 5px; overflow: hidden; }
.input-suffix input { border: 0; border-radius: 0; box-shadow: none; min-width: 0; }
.input-suffix em { display: grid; place-items: center; padding: 0 10px; background: var(--surface-2); color: var(--muted); font-style: normal; border-left: 1px solid var(--line); }
.health-panel { padding: 13px 14px 5px; display: grid; gap: 8px; }
.health-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 31px; border-bottom: 1px solid #edf0f3; }
.health-row:last-child { border-bottom: 0; }
.health-row span { color: var(--muted); }
.health-row strong { font-size: 12px; text-align: right; }
.settings-grid .alert { margin: 10px 14px 14px; }

.placeholder-card { max-width: 680px; margin: 60px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 34px; text-align: center; box-shadow: var(--shadow); }
.placeholder-card p { margin: 0 auto 22px; max-width: 520px; }
.phase-label { display: inline-block; color: var(--purple); background: var(--purple-soft); padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; margin-bottom: 13px; }

.login-body { min-height: 100vh; display: grid; place-items: center; background: #e9edf1; padding: 20px; }
.login-card { width: min(410px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 28px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; }
.login-brand > div { display: flex; flex-direction: column; }
.login-brand strong { font-size: 16px; }
.login-brand small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.login-heading { margin-bottom: 17px; }
.login-heading h1 { margin: 0 0 4px; font-size: 22px; }
.stack-form { display: grid; gap: 13px; margin-top: 15px; }
.login-help { margin: 15px 0 0; text-align: center; font-size: 12px; }
.login-actions { display: grid; gap: 10px; margin-top: 15px; text-align: center; }
.demo-note { margin-top: 16px; padding: 9px 10px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font-size: 11px; }

@media (max-width: 1180px) {
  :root { --sidebar-width: 190px; }
  .identity-strip { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .identity-strip .grow { grid-column: span 2; }
  .metrics-grid { grid-template-columns: repeat(3, minmax(125px, 1fr)); }
  .detail-grid { grid-template-columns: minmax(0, 1.7fr) minmax(290px, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 68px; }
  .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .brand-copy, .nav-item > span:not(.nav-icon), .nav-item small, .user-copy { display: none; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 0; }
  .user-panel { grid-template-columns: 1fr; justify-items: center; }
  .user-panel form { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-aside { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
  .span-2-card { grid-column: auto; }
}

@media (max-width: 680px) {
  :root { --sidebar-width: 0px; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { padding: 0 14px; }
  .timezone-chip { display: none; }
  .page-content { padding: 14px; }
  .workspace-heading { align-items: center; }
  .workspace-heading p { display: none; }
  .table-toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .search-control { min-width: 0; grid-column: span 2; }
  .compact-field select { min-width: 0; width: 100%; }
  .identity-strip { grid-template-columns: 1fr 1fr; }
  .identity-strip .grow { grid-column: span 2; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-aside { grid-template-columns: 1fr; }
  .address-grid { grid-template-columns: 1fr; }
  .address-card { border-right: 0; }
  .contact-row { grid-template-columns: 1fr auto; }
  .contact-detail, .contact-roles { display: none; }
  .form-grid.two-columns { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .modal { width: calc(100vw - 18px); }
}

.new-location-banner { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid #efd997; border-radius: var(--radius); background: var(--warning-soft); color: #6f4c00; }
.new-location-banner strong { display: block; margin-bottom: 2px; }
.new-location-banner p { margin: 0 0 7px; font-size: 12px; }
.new-location-banner .icon-button:hover { background: rgba(154, 103, 0, .09); }
.new-location-links { display: flex; flex-wrap: wrap; gap: 7px; }
.new-location-links a { display: inline-flex; align-items: center; min-height: 27px; padding: 0 9px; border: 1px solid #e1c978; border-radius: 4px; background: rgba(255,255,255,.55); color: #654600; font-size: 11px; font-weight: 700; }
.initial-status-alert { margin-bottom: 12px; }
.section-locked { position: relative; opacity: .57; pointer-events: none; user-select: none; }

/* Phase 2 outreach workflow */
.activity-composer-card { margin: 12px 0; }
.activity-form { display: grid; grid-template-columns: 150px 190px minmax(150px, .8fr) minmax(150px, .8fr); gap: 10px; padding: 13px 14px 14px; align-items: end; }
.activity-form .activity-note-field { grid-column: 1 / span 2; }
.activity-submit-row { grid-column: 3 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 12px; min-height: 35px; }
.activity-submit-row .muted { margin-right: auto; font-size: 11px; max-width: 360px; }
.timeline-card { min-height: 300px; }
.timeline-list { display: grid; }
.timeline-item { display: grid; grid-template-columns: 12px minmax(0,1fr) auto; gap: 11px; padding: 13px 14px; border-top: 1px solid #edf0f3; align-items: start; }
.timeline-item:first-child { border-top: 0; }
.timeline-item.compact { padding-top: 8px; padding-bottom: 8px; }
.timeline-marker { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--muted-2); box-shadow: 0 0 0 3px var(--surface-3); }
.timeline-marker.email { background: var(--accent); }
.timeline-marker.phone_contact { background: var(--success); }
.timeline-marker.phone_attempt { background: var(--muted-2); width: 7px; height: 7px; margin-left: 1px; }
.timeline-marker.in_person_visit { background: var(--purple); }
.timeline-marker.shopify_order { background: var(--warning); }
.timeline-content { min-width: 0; }
.timeline-heading { display: flex; justify-content: space-between; gap: 16px; }
.timeline-heading time, .timeline-content > small { color: var(--muted); font-size: 11px; }
.timeline-content p { margin: 5px 0 0; white-space: pre-wrap; }
.timeline-actions { display: flex; gap: 4px; }
.compact-contacts .contact-row { grid-template-columns: minmax(0,1fr) auto; padding: 10px 13px; }
.compact-contacts .contact-detail, .compact-contacts .contact-roles { grid-column: 1 / -1; }
.compact-contacts .row-actions { grid-column: 2; grid-row: 1; }
.outreach-summary { padding: 12px 14px 5px; display: grid; gap: 10px; }
.outreach-date-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.outreach-due { display: grid; gap: 2px; }
.outreach-due > span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; font-weight: 750; }
.outreach-due strong { font-size: 19px; }
.outreach-due small { color: var(--muted); }
.outreach-warning { display: grid; gap: 2px; padding: 9px 10px; border: 1px solid #efc06b; border-radius: 7px; background: #fff8e8; color: #744b00; }
.outreach-warning span { font-size: 12px; }
.pause-panel { border-left: 3px solid var(--warning); background: var(--warning-soft); padding: 9px; display: grid; gap: 3px; border-radius: 3px; }
.pause-panel span, .pause-panel small { font-size: 11px; }
.outreach-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.task-list { display: grid; }
.task-row { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid #edf0f3; padding: 10px 14px; }
.task-row:first-child { border-top: 0; }
.task-row > label { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; min-width: 0; }
.task-row > label input { margin-top: 3px; }
.task-row > label span { display: grid; min-width: 0; }
.task-row small, .task-row em { color: var(--muted); font-size: 11px; font-style: normal; }
.narrow-modal { width: min(480px, calc(100vw - 30px)); }

.calendar-workspace { max-width: 1600px; margin: 0 auto; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.calendar-controls { display: flex; gap: 7px; align-items: center; }
.calendar-title { margin: 0; font-size: 20px; }
.calendar-filter-row { display: flex; align-items: center; gap: 10px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(150px,1fr)); gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.day-column { min-width: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 330px; }
.day-column.today { border-color: #9fc1ef; box-shadow: inset 0 3px 0 var(--accent); }
.day-header { padding: 10px 11px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.day-header strong { font-size: 12px; }
.day-header span { color: var(--muted); font-size: 11px; }
.day-items { display: grid; padding: 7px; gap: 6px; }
.calendar-item { display: grid; gap: 3px; padding: 8px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 5px; background: var(--surface-2); color: var(--ink); }
.calendar-item:hover { text-decoration: none; background: var(--accent-soft); }
.calendar-item.task { border-left-color: var(--purple); }
.calendar-item strong { font-size: 11px; }
.calendar-item small { color: var(--muted); font-size: 10px; }
.overdue-tray { margin-bottom: 13px; border: 1px solid #efc1bd; background: var(--danger-soft); border-radius: var(--radius); }
.overdue-tray > header { display: flex; justify-content: space-between; padding: 9px 12px; border-bottom: 1px solid #efc1bd; }
.overdue-items { display: flex; gap: 7px; overflow-x: auto; padding: 8px; }
.overdue-items .calendar-item { min-width: 210px; border-left-color: var(--danger); background: var(--surface); }
.calendar-empty-day { color: var(--muted-2); font-size: 10px; padding: 8px 4px; text-align: center; }

.global-search { position: relative; width: min(440px, 40vw); }
.global-search input { width: 100%; min-height: 34px; border: 1px solid var(--line-strong); border-radius: 5px; padding: 0 11px; background: var(--surface-2); }
.global-search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); overflow: hidden; z-index: 50; }
.global-search-results a { display: grid; padding: 9px 11px; border-top: 1px solid #edf0f3; color: var(--ink); }
.global-search-results a:first-child { border-top: 0; }
.global-search-results a:hover { text-decoration: none; background: var(--surface-2); }
.global-search-results small { color: var(--muted); }

@media (max-width: 1100px) {
  .activity-form { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .activity-form .activity-note-field, .activity-submit-row { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .activity-form { grid-template-columns: 1fr; }
  .activity-form .activity-note-field, .activity-submit-row { grid-column: 1; }
  .timeline-item { grid-template-columns: 10px minmax(0,1fr); }
  .timeline-actions { grid-column: 2; }
  .global-search { display: none; }
}

/* Phase 3 sales intelligence and modal ergonomics */
html:has(dialog[open]), body:has(dialog[open]),
html.modal-open, body.modal-open { overflow: hidden; }
dialog.modal[open] { display: block; overflow: hidden; }
.modal-shell { max-height: min(760px, calc(100vh - 34px)); min-height: 0; }
.modal-shell > header, .modal-shell > footer { flex: 0 0 auto; }
.modal-body { flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

.metrics-grid { grid-template-columns: repeat(8, minmax(112px, 1fr)); }
.metric-card { min-height: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 11px; }
.metric-card > span { display: block; color: var(--muted); font-size: 10px; line-height: 1.25; text-transform: uppercase; letter-spacing: .045em; font-weight: 700; }
.metric-card > strong { display: block; margin-top: 9px; font-size: 16px; line-height: 1.25; font-variant-numeric: tabular-nums; }

.sales-section-header { align-items: flex-end; }
.sales-controls { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.compact-inline-filter { display: grid; gap: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.compact-inline-filter select { min-width: 180px; min-height: 30px; padding: 4px 7px; text-transform: none; letter-spacing: normal; }
.compact-check { display: flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 500; white-space: nowrap; }
.compact-check input { min-height: auto; width: 15px; height: 15px; margin: 0; }
.sales-table { min-width: 1120px; }
.sku-table { min-width: 1180px; }
.sales-table td, .sku-table td { height: 51px; font-size: 11px; }
.sales-table td small, .sku-table td small { display: block; color: var(--muted); font-size: 9.5px; margin-top: 2px; }
.sales-table .order-row { cursor: pointer; }
.sales-table .order-row.expanded { background: var(--accent-soft); }
.order-admin-link { color: var(--ink); }
.order-admin-link:hover { color: var(--accent); }
.expand-hint { opacity: .75; }
.order-detail-row td { padding: 0 !important; background: #fbfcfd; }
.order-detail-row:hover { background: #fbfcfd !important; }
.section-footer { min-height: 48px; padding: 8px 12px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.order-state, .order-effect-chip { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 7px; border-radius: 999px; font-size: 9.5px; font-weight: 750; white-space: nowrap; }
.order-state.qualifying, .order-effect-chip.qualifying { color: var(--success); background: var(--success-soft); }
.order-state.sample, .order-effect-chip.excluded { color: var(--muted); background: var(--surface-3); }
.order-state.cancelled { color: var(--danger); background: var(--danger-soft); }
.order-state.refunded { color: var(--warning); background: var(--warning-soft); }
.order-detail-grid { display: grid; grid-template-columns: minmax(360px, 1.5fr) minmax(220px, .8fr) minmax(220px, .8fr); gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.order-financial-grid { display: grid; grid-template-columns: repeat(4, minmax(85px, 1fr)); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--surface); }
.order-financial-grid > div { padding: 10px; border-left: 1px solid var(--line); }
.order-financial-grid > div:first-child { border-left: 0; }
.order-financial-grid span, .order-effect-panel span, .order-meta-panel span { color: var(--muted); font-size: 10px; }
.order-financial-grid strong { display: block; margin-top: 4px; font-size: 13px; }
.order-effect-panel, .order-meta-panel { display: grid; align-content: start; gap: 5px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.order-effect-panel > strong { margin-bottom: 2px; font-size: 11px; }
.order-effect-panel span { display: flex; align-items: center; gap: 6px; }
.effect-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.effect-dot.yes { background: var(--success); }
.effect-dot.no { background: var(--line-strong); }
.order-meta-panel a { font-size: 10px; font-weight: 700; margin-top: 2px; }
.order-lines-wrap { padding: 0 14px 14px; overflow-x: auto; }
.order-lines-table { width: 100%; min-width: 780px; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
.order-lines-table th { height: 31px; padding: 0 8px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.order-lines-table td { height: 38px; padding: 6px 8px; border-bottom: 1px solid #edf0f3; font-size: 10px; }
.order-lines-table tr:last-child td { border-bottom: 0; }
.order-lines-table td small { display: block; color: var(--muted); }
.order-no-lines { padding: 14px; color: var(--muted); font-size: 11px; }
.timeline-order-summary { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.timeline-order-details { margin-top: 8px; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: #fbfcfd; }
.timeline-order-details > summary { cursor: pointer; padding: 8px 10px; color: var(--accent); font-size: 10px; font-weight: 700; list-style-position: inside; }
.timeline-order-details .order-detail-grid { grid-template-columns: 1fr 1fr; }
.timeline-order-details .order-financial-grid { grid-column: 1 / -1; }
.timeline-order-details .order-lines-wrap { padding-top: 0; }

@media (max-width: 1350px) {
  .metrics-grid { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
  .order-detail-grid { grid-template-columns: 1fr 1fr; }
  .order-financial-grid { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .sales-section-header { align-items: flex-start; flex-direction: column; }
  .sales-controls { justify-content: flex-start; }
  .order-detail-grid { grid-template-columns: 1fr; }
  .order-financial-grid { grid-column: auto; }
}
@media (max-width: 680px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-financial-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-financial-grid > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .order-financial-grid > div:nth-child(4) { border-top: 1px solid var(--line); }
  .modal-shell { max-height: calc(100vh - 18px); }
}

/* Phase 4 reporting, map, and requested interface refinements */
.compact-task-toggle { font-size: 11px; gap: 5px; padding: 3px 6px; }
.compact-task-toggle input { width: 13px; height: 13px; }
.global-notes-card textarea { width: 100%; resize: vertical; min-height: 118px; }
.section-inline-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 9px; }

.reporting-workspace, .map-workspace { min-width: 0; }
.reporting-heading, .map-heading { align-items: flex-end; }
.report-filter-bar, .map-filter-bar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-soft); }
.report-filter-bar .compact-field, .map-filter-bar .compact-field { min-width: 130px; }
.report-user-filter { min-width: 230px !important; }
.report-user-filter select, .map-filter-bar select[multiple] { min-height: 68px; }
.report-user-filter small { display: block; max-width: 230px; margin-top: 3px; color: var(--muted); font-size: 9px; }
.report-loading { display: flex; min-height: 180px; align-items: center; justify-content: center; gap: 9px; color: var(--muted); }
.report-kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(125px, 1fr)); gap: 9px; margin-bottom: 13px; }
.report-kpi { min-width: 0; padding: 12px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-soft); }
.report-kpi > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.report-kpi strong { display: block; font-size: 23px; line-height: 1.1; }
.report-kpi small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.report-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(250px, .8fr); gap: 12px; margin-bottom: 12px; }
.report-chart-card, .call-summary-card { min-height: 285px; }
.activity-chart { display: flex; align-items: flex-end; gap: 5px; min-height: 190px; padding: 16px 13px 5px; overflow-x: auto; border-top: 1px solid var(--line-soft); }
.chart-day { display: flex; flex: 1 0 23px; min-width: 23px; max-width: 46px; flex-direction: column; align-items: center; gap: 5px; }
.chart-stack { display: flex; min-height: 155px; width: 70%; flex-direction: column-reverse; justify-content: flex-start; border-bottom: 1px solid var(--line); }
.chart-segment { display: block; min-height: 2px; height: var(--segment-height); width: 100%; border-radius: 2px 2px 0 0; opacity: .9; }
.chart-segment.email, .legend-email { background: #247da3; }
.chart-segment.attempt, .legend-attempt { background: #9aa5b1; }
.chart-segment.contact, .legend-contact { background: #2f8a5b; }
.chart-segment.visit, .legend-visit { background: #c87a2a; }
.chart-segment.order, .legend-order { background: #7657a8; }
.chart-day small { color: var(--muted); font-size: 8px; white-space: nowrap; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 14px 13px; color: var(--muted); font-size: 9px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 2px; }
.call-rate-visual { padding: 25px 20px 20px; }
.call-rate-number { display: flex; align-items: baseline; gap: 8px; }
.call-rate-number strong { font-size: 42px; letter-spacing: -.04em; }
.call-rate-number span { color: var(--muted); font-size: 11px; }
.call-rate-track { height: 9px; margin: 18px 0; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.call-rate-track span { display: block; height: 100%; border-radius: inherit; background: #2f8a5b; }
.call-rate-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.call-rate-counts div { padding: 11px; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 6px; }
.call-rate-counts strong, .call-rate-counts span { display: block; }
.call-rate-counts strong { font-size: 20px; }
.call-rate-counts span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.report-table th, .report-table td, .attribution-table th, .attribution-table td { white-space: nowrap; }
.attribution-table td:first-child small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }

.map-heading-actions { display: flex; align-items: center; gap: 9px; }
.map-filter-bar { align-items: flex-end; }
.map-filter-bar .compact-field:first-child { min-width: 150px; }
.map-overdue-toggle { margin-bottom: 5px; }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; min-height: calc(100vh - 235px); overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.map-canvas-wrap { position: relative; min-height: 560px; }
.dealer-map { position: absolute; inset: 0; background: var(--surface-2); }
.map-attribution { position: absolute; z-index: 500; right: 6px; bottom: 4px; padding: 2px 5px; background: rgba(255,255,255,.88); border-radius: 3px; color: #46515d; font-size: 8px; pointer-events: none; }
.map-library-warning { position: absolute; z-index: 600; inset: 50% auto auto 50%; transform: translate(-50%, -50%); max-width: 360px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); text-align: center; }
.map-results-panel { display: flex; min-width: 0; flex-direction: column; border-left: 1px solid var(--line); background: var(--surface); }
.map-results-panel > header { display: flex; justify-content: space-between; padding: 12px 13px; border-bottom: 1px solid var(--line); }
.map-results { overflow-y: auto; }
.map-result { display: block; width: 100%; padding: 11px 12px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.map-result:hover { background: var(--surface-2); }
.map-result.overdue { box-shadow: inset 3px 0 0 var(--danger); }
.map-result > span, .map-result > small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.map-result-heading { display: flex !important; align-items: center; justify-content: space-between; gap: 8px; margin: 0 !important; color: var(--ink) !important; }
.map-popup { min-width: 220px; }
.map-popup > strong, .map-popup > small { display: block; }
.map-popup > small { margin-top: 2px; color: var(--muted); }
.map-popup .status-pill { display: inline-flex; margin-top: 7px; }
.map-popup dl { margin: 9px 0; }
.map-popup dl > div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.map-popup dt { color: var(--muted); }
.map-popup dd { margin: 0; font-weight: 600; }
.map-popup p { margin: 8px 0; color: var(--muted); font-size: 10px; line-height: 1.35; }
.map-popup-actions { display: flex; justify-content: space-between; gap: 10px; }
.map-popup-link { padding: 0; border: 0; background: transparent; color: var(--link); cursor: pointer; font: inherit; }
.leaflet-popup-content-wrapper { border-radius: 7px; }
.leaflet-popup-content { margin: 13px 14px; color: var(--ink); font-family: inherit; font-size: 10px; }

@media (max-width: 1200px) {
  .report-kpi-grid { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .map-layout { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 900px) {
  .report-kpi-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .report-grid { grid-template-columns: 1fr; }
  .map-layout { grid-template-columns: 1fr; }
  .map-canvas-wrap { min-height: 480px; }
  .map-results-panel { max-height: 330px; border-top: 1px solid var(--line); border-left: 0; }
}

/* Compact multi-select dropdowns used by reporting and map filters. */
.native-multiselect-hidden { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
.multi-select-dropdown { position: relative; min-width: 160px; text-transform: none; letter-spacing: normal; font-weight: 500; }
.multi-select-trigger { width: 100%; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; text-align: left; }
.multi-select-trigger:hover { background: var(--surface-2); }
.multi-select-dropdown.open .multi-select-trigger { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,113,217,.13); }
.multi-select-arrow { color: var(--muted); font-size: 10px; }
.multi-select-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; min-width: 100%; max-height: 260px; overflow: auto; padding: 5px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); box-shadow: var(--shadow); }
.multi-select-option { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 5px 7px; border-radius: 4px; color: var(--ink); font-size: 12px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.multi-select-option:hover { background: var(--surface-2); }
.multi-select-option input { width: 14px; height: 14px; min-height: 0; margin: 0; }
.map-overdue-toggle { font-size: 11px; min-height: 28px; gap: 5px; }
.map-overdue-toggle input { width: 13px; height: 13px; min-height: 0; }

.shopify-actions { padding: 10px 14px 14px; border-top: 1px solid var(--border); }
.shopify-help { margin: 0 14px 14px; }
.shopify-scope-status { padding: 0 14px; }
.shopify-scope-status .alert { margin: 0 0 10px; }
.scope-note { margin: -4px 0 12px; color: var(--muted); font-size: 12px; }

/* Shopify human matching workflow and profile */
.shopify-match-dialog { width: min(1040px, calc(100vw - 40px)); max-width: 1040px; }
.shopify-match-dialog .dialog-shell { max-height: min(860px, calc(100vh - 40px)); }
.match-toolbar { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.match-toolbar input { flex: 1; }
.match-summary { padding: 8px 16px; color: var(--muted); font-size: 11px; background: var(--surface-2); }
.shopify-match-list { overflow-y: auto; padding: 0 16px 12px; }
.shopify-match-row { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.shopify-match-row h4 { margin: 0; font-size: 14px; }
.shopify-match-locations { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 10px; }
.shopify-location-chip { padding: 3px 6px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 9px; }
.match-link-grid { display: grid; grid-template-columns: minmax(220px, 1fr) 210px auto; gap: 8px; align-items: end; }
.match-candidate-wrap { position: relative; }
.match-candidates { position: absolute; z-index: 3000; top: calc(100% + 3px); left: 0; right: 0; max-height: 220px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 5px; box-shadow: var(--shadow); }
.match-candidate { display: block; width: 100%; padding: 8px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; text-align: left; cursor: pointer; }
.match-candidate:hover { background: var(--surface-2); }
.match-candidate small { display: block; color: var(--muted); }
.exact-match-note { margin-top: 5px; color: var(--success); font-size: 10px; }
.profile-card { max-width: 760px; }
.user-panel-link { color: inherit; text-decoration: none; }
.sidebar-logout { padding: 0 12px 12px; }
.sidebar-logout .button { width: 100%; }

/* Keep filter dropdowns above Leaflet and constrain the map workspace. */
.map-filter-bar { position: relative; z-index: 1200; overflow: visible; }
.map-filter-bar .multi-select-dropdown.open { z-index: 2200; }
.multi-select-menu { z-index: 2500; }
.map-layout { height: calc(100vh - 235px); min-height: 560px; }
.map-results-panel { min-height: 0; overflow: hidden; }
.map-results { min-height: 0; flex: 1; overflow-y: auto; }
.map-results-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-top: 1px solid var(--line); background: var(--surface); }
.map-results-pagination span { color: var(--muted); font-size: 9px; }
.crm-map-pin { width: 14px; height: 14px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.crm-map-pin.blue { background: #2475c7; }
.crm-map-pin.red { background: #d64545; }
.merge-options{display:grid;gap:10px}.merge-choice{display:flex;gap:12px;align-items:flex-start;border:1px solid var(--border-color,#d7dce2);border-radius:8px;padding:14px;cursor:pointer}.merge-choice input{margin-top:4px}.merge-choice span{display:grid;gap:4px}.merge-choice small{color:#667085}
.tag-list{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px}.tag-chip{display:inline-flex;gap:6px;align-items:center;padding:4px 8px;border-radius:999px;background:#eef2f6;font-size:12px}.tag-chip button{border:0;background:none;cursor:pointer}.attachment-list{display:grid;gap:8px;margin-bottom:10px}.attachment-row{display:grid;grid-template-columns:1fr auto;gap:2px 8px;align-items:center}.attachment-row small{grid-column:1;color:#667085}.attachment-row button{grid-column:2;grid-row:1/3}
.inline-form{display:flex;gap:8px;margin-bottom:12px}.inline-form input{flex:1}.settings-tag-list{display:grid;gap:8px}.settings-tag-row{display:grid;grid-template-columns:minmax(180px,1fr) auto auto auto auto;align-items:center;gap:8px}.settings-tag-row span{color:#667085;font-size:12px}

.geocode-progress { display: grid; gap: 7px; padding: 10px 12px; margin: 0 0 10px; border: 1px solid #cbdff8; border-radius: 6px; background: #f5f9ff; }
.geocode-progress-copy { display: flex; justify-content: space-between; gap: 16px; align-items: center; font-size: 12px; }
.geocode-progress-copy span { color: var(--muted); text-align: right; }
.geocode-progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: #dce7f5; }
.geocode-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease; }

/* Unified dealer location addresses and user administration */
.unified-location-addresses { grid-column: 1 / -1; display: grid; gap: 9px; margin-bottom: 10px; }
.location-addresses-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.location-addresses-heading span { color: var(--muted); font-size: 10px; text-align: right; }
.location-address-card { border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.location-address-card > header { display: flex; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
.location-address-card > header span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.location-address-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.location-address-columns > div { padding: 10px; min-width: 0; }
.location-address-columns > div + div { border-left: 1px solid var(--line); }
.location-address-columns small { display: block; margin-bottom: 5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.editable-address-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shopify-address-review { display: grid; gap: 10px; margin-top: 12px; padding: 12px; border: 1px solid #a9c9ed; border-radius: 6px; background: #f3f8fe; }
.shopify-address-review > div:first-child { display: grid; gap: 2px; }
.shopify-address-review > div:first-child span, .shopify-address-review p { color: var(--muted); font-size: 10px; margin: 0; }
.shopify-address-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shopify-address-comparison > div { padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.shopify-address-comparison small { display: block; margin-bottom: 5px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.shopify-address-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.temporary-password { padding: 14px; border: 1px dashed var(--line-strong); border-radius: 6px; background: var(--surface-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; word-break: break-all; user-select: all; }
.block { display: block; margin-top: 3px; }
@media (max-width: 800px) { .location-address-columns, .editable-address-grid, .shopify-address-comparison { grid-template-columns: 1fr; } .location-address-columns > div + div { border-left: 0; border-top: 1px solid var(--line); } }


/* Post-release usability fixes */
.all-archive-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 7px 0 2px;
  color: var(--muted);
  font-size: 11px;
}
.all-archive-toggle input { width: 13px; height: 13px; margin: 0; }
.unified-location-addresses { gap: 14px; margin-top: 3px; margin-bottom: 16px; }
.location-address-card > header { padding: 11px 13px; }
.location-address-columns > div { padding: 13px 14px 15px; }
.location-address-columns small { margin-bottom: 8px; }
.location-address-columns .address-copy { line-height: 1.55; }

/* Stringjoy B2B CRM branding */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 10px 19px;
  text-align: center;
}
.brand-logo {
  display: block;
  width: 154px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
.brand-subtitle {
  color: #b8c2ce;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .16em;
  line-height: 1;
  text-transform: uppercase;
  padding-left: 0;
  text-align: center;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 18px;
  margin: -24px -24px 30px;
  background: var(--sidebar);
  border-radius: 7px 7px 0 0;
}
.login-brand-logo {
  display: block;
  width: 190px;
  max-width: 100%;
  height: auto;
}
.login-brand-subtitle {
  color: #c2cad4;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .17em;
  text-transform: uppercase;
}
@media (max-width: 1100px) and (min-width: 721px) {
  .brand-logo { width: 44px; }
  .brand-subtitle { display: none; }
}

/* Incremental dealer-detail loading */
.load-more-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.load-more-footer > span { color: var(--muted); font-size: 11px; }

/* Dealer-list sorting, address alignment, and compact company overrides */
.unified-location-addresses { margin-left: 18px; margin-right: 18px; }
.compact-override-copy { min-height: 0; padding-top: 2px; padding-bottom: 2px; }
@media (max-width: 800px) { .unified-location-addresses { margin-left: 12px; margin-right: 12px; } }

/* Human-centric Shopify account linking and consistent compact-card spacing. */
.compact-card-body { padding: 14px; }
.compact-card-body > :last-child { margin-bottom: 0; }
.compact-card-body .button-row { padding: 0; }
.shopify-link-browser-modal { width: min(860px, calc(100vw - 32px)); }
.shopify-link-browser-modal .modal-shell { width: 100%; }
.shopify-link-browser { display: grid; gap: 12px; }
.shopify-link-search-label { display: grid; gap: 6px; font-weight: 650; }
.shopify-link-summary { min-height: 18px; }
.shopify-link-results { display: grid; gap: 10px; max-height: min(520px, calc(100vh - 290px)); overflow: auto; padding-right: 3px; }
.shopify-link-company { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); overflow: hidden; }
.shopify-link-company-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.shopify-link-company-head h4 { margin: 0 0 2px; font-size: 14px; }
.shopify-link-company-head small, .shopify-link-location small { display: block; color: var(--muted); margin-top: 2px; }
.shopify-link-location-list { display: grid; }
.shopify-link-location { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.shopify-link-location:first-child { border-top: 0; }
.shopify-link-no-locations { padding: 12px 14px; }
.compact-link-state { font-size: 11px; text-align: right; }
@media (max-width: 700px) {
  .shopify-link-company-head, .shopify-link-location { align-items: flex-start; flex-direction: column; }
}
