:root {
  --blue: #356fff;
  --blue-dark: #163f9f;
  --navy: #050e21;
  --navy-2: #102656;
  --bg: #f3f6fb;
  --line: #d9e3f1;
  --muted: #64748b;
  --text: #0b1832;
  --cyan: #4fd8ff;
  --violet: #6c5df5;
}

/* This navigation belongs only on phones. Keep it out of desktop layout even
   if a browser is still holding an older dashboard.css file. */
.mobile-bottom-nav { display: none !important; }
html { color-scheme: light; }
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07101f;
  --line: #263a59;
  --muted: #9eacc1;
  --text: #edf3ff;
}
html[data-theme="dark"] body { background: radial-gradient(circle at 90% 0, #14274b 0, transparent 28%), var(--bg); color: var(--text); }
html[data-theme="dark"] .crm-topbar { background: rgba(8, 18, 35, 0.9); border-color: var(--line); }
html[data-theme="dark"] .crm-topbar .crumb { color: #c6d5ec; }
html[data-theme="dark"] .crm-topbar .icon-button {
  background: #14233b;
  border-color: #3b5274;
  color: #eef4ff;
}
html[data-theme="dark"] .crm-topbar .avatar { background: #244779; color: #ffffff; }
html[data-theme="dark"] .crm-content,
html[data-theme="dark"] .crm-main { background-color: transparent; }
html[data-theme="dark"] .panel,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .settings-panel,
html[data-theme="dark"] .command-metrics,
html[data-theme="dark"] .record-modal,
html[data-theme="dark"] .onboarding-card { background: #101d31; border-color: var(--line); color: var(--text); }
html[data-theme="dark"] .modal-head {
  background: rgba(16, 29, 49, 0.98);
  border-color: var(--line);
}
html[data-theme="dark"] .modal-head h2,
html[data-theme="dark"] .record-form label { color: #edf3ff; }
html[data-theme="dark"] .crm-table th {
  background: #0d1a2d;
  border-color: var(--line);
  color: #aebdd3;
}
html[data-theme="dark"] .crm-table td {
  background: #101d31;
  border-color: var(--line);
  color: var(--text);
}
html[data-theme="dark"] .crm-table tbody tr:hover,
html[data-theme="dark"] .clickable-row:hover td {
  background: #172942;
  color: #f2f6ff;
}
html[data-theme="light"] .crm-table th { background: #fafbfd; color: #64748b; }
html[data-theme="light"] .crm-table td { background: #ffffff; color: #0b1832; }
html[data-theme="light"] .clickable-row:hover td { background: #f0f5ff; color: #0b1832; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .status-select,
html[data-theme="dark"] .hours-row { background: #0a1527; border-color: #334967; color: var(--text); }
html[data-theme="dark"] .datetime-shortcuts button,
html[data-theme="dark"] .crm-button.secondary,
html[data-theme="dark"] .icon-button { background: #13213a; border-color: #385173; color: #dbe8ff; }
html[data-theme="dark"] .module-note { background: #101d31; border-color: #2a4162; color: #aebbd0; }
html[data-theme="dark"] .analytics-tabs,
html[data-theme="dark"] .settings-tabs {
  background: #101d31;
  border-color: #314866;
}
html[data-theme="dark"] .analytics-tabs button,
html[data-theme="dark"] .settings-tabs button { color: #aebdd3; }
html[data-theme="dark"] .analytics-tabs button:hover,
html[data-theme="dark"] .settings-tabs button:hover { background: #172942; color: #f2f6ff; }
html[data-theme="dark"] .analytics-tabs button.active,
html[data-theme="dark"] .settings-tabs button.active { background: #244f9f; color: #ffffff; }
html[data-theme="dark"] .activity {
  background: linear-gradient(180deg, #0d1a2d, #101d31);
  color: #aebdd3;
}
html[data-theme="dark"] .activity-graph { border-color: #36547c; }
html[data-theme="dark"] .activity-graph::before {
  background: linear-gradient(180deg, rgba(79, 216, 255, 0.3), rgba(53, 111, 255, 0.04));
}
html[data-theme="dark"] .health-banner,
html[data-theme="dark"] .command-ok { background: #101d31; border-color: #314866; }
html[data-theme="dark"] .health-banner > strong,
html[data-theme="dark"] .analytics-total { color: #75a7ff; }

.health-rate { display: grid; justify-items: end; gap: 4px; text-align: right; }
.health-rate strong { font-size: 30px; color: #3159dc; }
.health-rate small { font-size: 11px; color: #596a86; }
.workflow-scope { color: #596a86; font-size: 13px; }
.data-load-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  margin-bottom: 22px;
  border: 1px solid #efb4a1;
  border-radius: 12px;
  background: #fff3ed;
  color: #71301c;
}
.data-load-alert[hidden] { display: none; }
.data-load-alert strong { display: block; }
.data-load-alert p { margin: 5px 0 0; line-height: 1.5; }
.data-load-alert button { flex: none; }
html[data-theme="dark"] .data-load-alert { background: #302025; border-color: #845240; color: #ffcbac; }
html[data-theme="dark"] .data-load-alert p { color: #f0c4b0; }
.health-banner[data-state="attention"] { background: #fff6f1; border-color: #f4c9ae; }
.health-banner[data-state="attention"] .health-dot { background: #d65f23; }
.health-banner[data-state="attention"] .health-rate strong { color: #9d4215; }
.health-banner[data-state="idle"] .health-dot { background: #8d9aaa; }
html[data-theme="dark"] .health-rate strong { color: #8eb8ff; }
html[data-theme="dark"] .health-rate small,
html[data-theme="dark"] .workflow-scope { color: #b1c2dc; }
html[data-theme="dark"] .health-banner[data-state="attention"] { background: #302025; border-color: #845240; }
html[data-theme="dark"] .health-banner[data-state="attention"] .health-rate strong { color: #ffb385; }
@media (max-width: 580px) {
  .health-banner { flex-wrap: wrap; gap: 14px; }
  .health-rate { justify-items: start; text-align: left; }
  .data-load-alert { flex-wrap: wrap; }
}
html[data-theme="dark"] .mini-action { background: #13213a; border-color: #385173; color: #dbe8ff; }
html[data-theme="dark"] .mini-action:hover { background: #1b3150; }
html[data-theme="dark"] .thread.active { background: #172942; }
html[data-theme="dark"] .empty-icon,
html[data-theme="dark"] .person-dot { background: #1a3150; color: #77b5ff; }
html[data-theme="dark"] .hours-row.closed input[type="time"] { background: #101827; color: #7f8da3; }
html[data-theme="dark"] .settings-section h2,
html[data-theme="dark"] .panel-head h2,
html[data-theme="dark"] .page-head h1 { color: #edf3ff; }
html[data-theme="dark"] .pager button,
html[data-theme="dark"] .history-list > div { background: #0d1a2d; border-color: #314866; color: #edf3ff; }
html[data-theme="dark"] .quick-create button { background: linear-gradient(145deg, #111f35, #0c1728); border-color: #314866; color: #edf3ff; }
html[data-theme="dark"] .quick-create button:hover,
html[data-theme="dark"] .quick-create button:focus-visible { border-color: #6e9eff; box-shadow: 0 11px 25px rgba(30, 87, 190, 0.24); }
html[data-theme="dark"] .estimate-items-editor { background: #0a1527; border-color: #314866; }
html[data-theme="dark"] .estimate-remove-item { background: #2b1720; border-color: #70404b; color: #ff9eaa; }
html[data-theme="dark"] .estimate-editor-summary { border-color: #314866; color: #85afff; }
html[data-theme="dark"] .focus-row { border-color: #263a59; }
html[data-theme="dark"] .focus-row:hover { background: #14243a; }
html[data-theme="dark"] .focus-marker { background: #7c94b2; box-shadow: 0 0 0 4px #22334a; }
html[data-theme="dark"] .focus-row.priority-high .focus-marker { background: #ff9c4a; box-shadow: 0 0 0 4px #49301f; }
html[data-theme="dark"] .focus-row.priority-urgent .focus-marker { background: #ff6c7a; box-shadow: 0 0 0 4px #4c2630; }
html[data-theme="dark"] .focus-row strong,
html[data-theme="dark"] .focus-empty strong { color: #edf3ff; }
.focus-actions { display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.focus-actions .mini-action.primary { border-color: #315fdd; background: #356fff; color: #fff; }
.focus-actions .mini-action.primary:hover { background: #285bd8; }
html[data-theme="dark"] .focus-actions .mini-action.primary { border-color: #6c91ff; background: #356fff; color: #fff; }
.focus-load-warning { padding: 12px 15px; border-bottom: 1px solid #f1c9ad; background: #fff6ee; color: #8c3f13; font-size: 13px; font-weight: 700; line-height: 1.45; }
html[data-theme="dark"] .focus-load-warning { border-color: #754b38; background: #32231f; color: #ffc19b; }
@media (max-width: 600px) {
  .focus-actions { grid-column: 2; justify-content: flex-start; }
}
html[data-theme="dark"] .crm-table tr.task-overdue td:first-child::after { background: #4c2630; color: #ff9daa; }
html[data-theme="dark"] .template-card { border-color: #263a59; }
html[data-theme="dark"] .template-card > div > span { background: #19345b; color: #9bc2ff; }
html[data-theme="dark"] .template-edit { color: #8eb8ff; }
html[data-theme="dark"] .template-variable-help { background: #0a1527; border-color: #314866; color: #aebdd3; }
html[data-theme="dark"] .schedule-nav button,
html[data-theme="dark"] .schedule-filter select { background: #13213a; border-color: #385173; color: #edf3ff; }
html[data-theme="dark"] .schedule-day.is-today { background: #142641; }
html[data-theme="dark"] .schedule-entry { background: #183050; border-color: #32558c; color: #edf3ff; }
html[data-theme="dark"] .schedule-entry small { color: #99bbff; }
html[data-theme="dark"] .schedule-entry.schedule-task { background: #18332f; border-color: #2b6256; }
html[data-theme="dark"] .schedule-entry.schedule-task small { color: #99e6c7; }
html[data-theme="dark"] .schedule-entry.is-conflict { background: #3c202b; border-color: #9e5261; }
html[data-theme="dark"] .schedule-entry em { color: #ff9daa; }
html[data-theme="dark"] .schedule-notice { background: #3c202b; border-color: #9e5261; color: #ffb5bf; }
html[data-theme="dark"] .schedule-notice.muted { background: #14243a; border-color: #314866; color: #aebdd3; }
html[data-theme="dark"] .activity-bars { border-color: #36547c; }

html[data-theme="light"] .record-modal,
html[data-theme="light"] .modal-head { background: #ffffff; color: #0b1832; }
html[data-theme="light"] .record-form label,
html[data-theme="light"] .modal-head h2 { color: #0b1832; }

.status-select {
  min-width: 116px;
  padding: 7px 28px 7px 10px;
  border: 1px solid #cdd8e8;
  border-radius: 999px;
  background: #f7faff;
  color: #18304f;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
}

.empty-table-message {
  padding: 36px 20px !important;
  color: #64748b;
  text-align: center;
}
.module-note {
  margin: -8px 0 22px;
  padding: 12px 16px;
  border: 1px solid #d8e3f2;
  border-radius: 12px;
  background: #f8fbff;
  color: #526783;
}
body {
  font-family:
    "Avenir Next",
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 90% 0, #eaf0ff 0, transparent 28%), var(--bg);
}
.crm-sidebar {
  background: radial-gradient(
    circle at 30% 0,
    #142f67 0,
    #08152e 40%,
    #050e21 100%
  );
  border-right: 1px solid rgba(118, 159, 231, 0.16);
}
.crm-logo span {
  background: linear-gradient(
    145deg,
    var(--cyan),
    var(--blue) 55%,
    var(--violet)
  );
  border-radius: 10px 4px 10px 4px;
  box-shadow: 0 8px 20px rgba(54, 112, 255, 0.3);
}
.crm-link:hover,
.crm-link.active {
  background: linear-gradient(
    90deg,
    rgba(53, 111, 255, 0.28),
    rgba(108, 93, 245, 0.11)
  );
  box-shadow: inset 2px 0 var(--cyan);
}
.crm-topbar {
  background: rgba(255, 255, 255, 0.87);
  backdrop-filter: blur(18px);
}
.crm-button {
  background: linear-gradient(135deg, #3d7cff, #3159dc 58%, #6d5df5);
  border-radius: 9px;
  box-shadow: 0 9px 24px rgba(43, 91, 202, 0.18);
}
.stat,
.panel {
  border-radius: 14px;
  box-shadow: 0 15px 45px rgba(26, 56, 105, 0.065);
}

#view-appointments .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.appointment-upcoming-label {
  display: inline-block;
  margin-left: 8px;
  color: #2555b2;
  font-size: 12px;
  font-weight: 700;
}
.guidance-disclosure {
  padding: 14px 17px;
  border: 1px solid #c9d9f6;
  border-radius: 10px;
  background: #f4f8ff;
  color: #254269 !important;
  line-height: 1.55;
}
.guidance-preset { margin: 20px 0 10px; }
.guidance-preset label { margin: 0 0 8px; }
.guidance-preset-actions { display: flex; align-items: stretch; gap: 10px; }
.guidance-preset-actions select {
  min-width: 0;
  flex: 1;
  padding: 11px 12px;
  border: 1px solid #cbd8e8;
  border-radius: 8px;
  background: #fff;
  color: #0b1832;
  font: inherit;
}
.guidance-preset-actions button { flex: none; }
.guidance-save-hint { margin: 14px 0 0 !important; font-size: 13px !important; }
.agency-review-panel { margin: 22px 0; }
.agency-review-queue { margin: 22px 0; }
.agency-review-queue .panel-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.agency-review-queue-count { font-weight: 700; color: var(--text); white-space: nowrap; }
.agency-review-queue-help { color: var(--muted); line-height: 1.5; }
.agency-review-queue-list { display: grid; gap: 10px; margin-top: 18px; }
.agency-review-queue-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
html[data-theme="dark"] .agency-review-queue-item { background: #101d31; }
.agency-review-queue-item.due { border-left: 4px solid #5277cd; }
.agency-review-queue-item strong, .agency-review-queue-item small { display: block; }
.agency-review-queue-item strong { color: var(--text); }
.agency-review-queue-item small { margin-top: 4px; color: var(--muted); line-height: 1.4; }
.agency-review-queue-actions { display: flex; gap: 8px; align-items: center; flex: none; }
@media (max-width: 680px) {
  .agency-review-queue .panel-head, .agency-review-queue-item { flex-direction: column; align-items: stretch; }
  .agency-review-queue-count { white-space: normal; }
  .agency-review-queue-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .agency-review-queue-item .crm-button { width: 100%; }
}

@media (max-width: 420px) {
  .agency-review-queue-actions { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .mobile-bottom-nav { display: grid !important; }
}
.agency-review-panel > p:not(.crm-kicker) { color: var(--muted); line-height: 1.5; }
.agency-review-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin: 20px 0; }
.agency-review-form label { display: block; color: var(--text); font-size: 13px; font-weight: 700; }
.agency-review-form .wide { grid-column: 1 / -1; }
.agency-review-form select, .agency-review-form input, .agency-review-form textarea {
  display: block; width: 100%; margin-top: 7px; padding: 11px 12px;
  border: 1px solid #cbd8e8; border-radius: 8px; background: #fff; color: #0b1832; font: inherit;
}
.agency-review-form textarea { min-height: 100px; resize: vertical; }
.agency-review-form button { justify-self: start; }
.agency-review-message { min-height: 20px; }
.sms-provider-panel { margin-top: 20px; }
.sms-provider-panel .crm-table td:last-child { max-width: 480px; white-space: pre-wrap; overflow-wrap: anywhere; }
html[data-theme="dark"] .agency-review-form select,
html[data-theme="dark"] .agency-review-form input,
html[data-theme="dark"] .agency-review-form textarea { background: #0a1527; border-color: #334967; color: #edf3ff; }
@media (max-width: 800px) { .agency-review-form { grid-template-columns: 1fr; } }
html[data-theme="dark"] .guidance-disclosure {
  background: #132644;
  border-color: #35537e;
  color: #d7e6ff !important;
}
html[data-theme="dark"] .guidance-preset-actions select {
  background: #0a1527;
  border-color: #334967;
  color: #edf3ff;
}
@media (max-width: 620px) {
  .guidance-preset-actions { flex-direction: column; }
  .guidance-preset-actions button { width: 100%; }
}
html[data-theme="dark"] .appointment-upcoming-label { color: #a9c8ff; }
.appointment-past-due-label {
  display: block;
  margin-top: 5px;
  color: #9a4718;
  font-size: 12px;
  font-weight: 700;
}
html[data-theme="dark"] .appointment-past-due-label { color: #ffc08d; }
@media (max-width: 1100px) {
  #view-appointments .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  #view-appointments .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.onboarding-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  margin-bottom: 22px;
  border: 1px solid #b9cdfc;
  border-radius: 15px;
  background: linear-gradient(125deg, #ffffff, #eef5ff 58%, #f3f0ff);
  box-shadow: 0 15px 45px rgba(26, 56, 105, 0.08);
}
.onboarding-card[hidden] { display: none; }
.onboarding-card h2 { margin: 0 0 6px; }
.onboarding-card p { margin: 0; color: var(--muted); }
.onboarding-card ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
}
.onboarding-card li {
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}
.onboarding-card li.complete { color: #08734a; background: #e8f8f1; }
.onboarding-card li.pending {
  color: #526174;
  background: #edf1f6;
  border: 1px solid #d9e1eb;
}

@media (max-width: 760px) {
  .onboarding-card { align-items: stretch; flex-direction: column; }
}
\n\n/* Apex Command V2 dark-mode additions */
html[data-theme="dark"] { --surface-elevated: rgba(16,29,49,.98); }
html[data-theme="dark"] .mobile-bottom-nav { background: rgba(8,18,35,.95); border-color: #263a59; }
html[data-theme="dark"] .mobile-bottom-nav a { color: #8fa0b9; }
html[data-theme="dark"] .mobile-bottom-nav a.active { color: #8fc6ff; background: rgba(79,216,255,.08); }
html[data-theme="dark"] .crm-table tr { background: #101d31; border-color: #263a59; }

/* Estimate follow-up workspace */
.estimate-status-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 20px;
  padding: 16px 18px;
  border: 1px solid #d9e3f1;
  border-radius: 12px;
  background: #f7f9fc;
}
.estimate-status-panel > div:first-child {
  display: grid;
  gap: 3px;
}
.estimate-status-panel span {
  color: #65758b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
}
.estimate-status-panel strong {
  color: #101d33;
  font-size: 16px;
  line-height: 1.35;
}
.estimate-status-panel small {
  color: #65758b;
  font-size: 13px;
  line-height: 1.45;
}
.estimate-status-value {
  min-width: 140px;
  padding-left: 20px;
  border-left: 1px solid #d9e3f1;
  text-align: right;
}
.estimate-status-value strong {
  display: block;
  margin-top: 3px;
  font-size: 20px;
}
html[data-theme="dark"] .estimate-status-panel {
  border-color: #31445f;
  background: #0c192b;
}
html[data-theme="dark"] .estimate-status-panel strong { color: #f1f5fc; }
html[data-theme="dark"] .estimate-status-panel span,
html[data-theme="dark"] .estimate-status-panel small { color: #9fb0c8; }
html[data-theme="dark"] .estimate-status-value { border-color: #31445f; }
.estimate-age-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border: 1px solid #d7e1ee;
  border-radius: 999px;
  background: #f3f6fa;
  color: #526174;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.estimate-age-badge.is-aging {
  border-color: #f0c9a4;
  background: #fff5e9;
  color: #8b4b13;
}
html[data-theme="dark"] .estimate-age-badge {
  border-color: #354862;
  background: #15243a;
  color: #c4d0e0;
}
html[data-theme="dark"] .estimate-age-badge.is-aging {
  border-color: #775536;
  background: #302315;
  color: #ffd0a3;
}
@media (max-width: 620px) {
  .estimate-status-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }
  .estimate-status-value {
    min-width: 0;
    padding: 12px 0 0;
    border-top: 1px solid #d9e3f1;
    border-left: 0;
    text-align: left;
  }
  html[data-theme="dark"] .estimate-status-value { border-top-color: #31445f; }
}

/* Revenue recovery workspace */
.recovery-page-head { margin-bottom: 16px; }
.recovery-safety-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  align-items: start;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid #cbd8e8;
  border-radius: 12px;
  background: #f6f8fb;
  color: #526174;
  font-size: 13px;
  line-height: 1.5;
}
.recovery-safety-note strong { color: #17263d; }
.recovery-stat-grid .stat em { max-width: 210px; }
.recovery-panel { overflow: hidden; }
.recovery-toolbar { align-items: flex-end; }
.recovery-toolbar h2 { margin-bottom: 4px; }
.recovery-toolbar p { margin: 0; color: var(--muted); }
.recovery-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.recovery-controls .search { width: min(340px, 32vw); }
.recovery-list { display: grid; }
.recovery-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 15px;
  align-items: center;
  padding: 17px 20px;
  border-top: 1px solid #e1e8f1;
  background: #fff;
}
.recovery-row:first-child { border-top: 0; }
.recovery-row:hover { background: #f9fbfe; }
.recovery-icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: #edf3ff;
  color: #315ec5;
  font-size: 17px;
  font-weight: 850;
}
.recovery-icon.segment-declined_estimate { background: #fff3e8; color: #99521b; }
.recovery-icon.segment-past_customer { background: #ecf7f3; color: #15735a; }
.recovery-copy { display: grid; gap: 3px; min-width: 0; }
.recovery-copy small { color: #728198; font-size: 11px; font-weight: 750; letter-spacing: .025em; text-transform: uppercase; }
.recovery-copy strong { overflow: hidden; color: #13223a; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.recovery-copy span { overflow: hidden; color: #607089; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.recovery-copy b { margin-top: 3px; color: #1f4fae; font-size: 13px; }
.recovery-actions { display: flex; gap: 7px; justify-content: flex-end; }
.recovery-limit { margin: 0; padding: 14px 20px; border-top: 1px solid #e1e8f1; color: var(--muted); font-size: 12px; }
html[data-theme="dark"] .recovery-safety-note { border-color: #31445f; background: #0c192b; color: #9fb0c8; }
html[data-theme="dark"] .recovery-safety-note strong { color: #edf3ff; }
html[data-theme="dark"] .recovery-row { border-color: #283a54; background: #101d31; }
html[data-theme="dark"] .recovery-row:hover { background: #14243a; }
html[data-theme="dark"] .recovery-icon { background: #1a3155; color: #a8c8ff; }
html[data-theme="dark"] .recovery-icon.segment-declined_estimate { background: #342517; color: #ffd0a3; }
html[data-theme="dark"] .recovery-icon.segment-past_customer { background: #123329; color: #99dbc4; }
html[data-theme="dark"] .recovery-copy strong { color: #eef4ff; }
html[data-theme="dark"] .recovery-copy span,
html[data-theme="dark"] .recovery-copy small { color: #9fb0c8; }
html[data-theme="dark"] .recovery-copy b { color: #a9c8ff; }
html[data-theme="dark"] .recovery-limit { border-color: #283a54; }
@media (max-width: 900px) {
  .recovery-toolbar { align-items: stretch; flex-direction: column; }
  .recovery-controls .search { width: 100%; }
  .recovery-controls { width: 100%; }
  .recovery-controls > * { flex: 1; min-width: 0; }
  .recovery-row { grid-template-columns: 38px minmax(0, 1fr); }
  .recovery-actions { grid-column: 1 / -1; justify-content: stretch; }
  .recovery-actions button { flex: 1; }
}
@media (max-width: 620px) {
  .recovery-safety-note { grid-template-columns: 1fr; }
  .recovery-controls { align-items: stretch; flex-direction: column; }
  .recovery-row { padding: 16px; }
  .recovery-actions { display: grid; grid-template-columns: 1fr; }
}

/* Post-job review and referral workspace */
.reputation-safety-note {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  padding: 15px 17px;
  border: 1px solid #cbd8e8;
  border-radius: 12px;
  background: #f6f8fb;
  color: #596a81;
  font-size: 13px;
  line-height: 1.5;
}
.reputation-safety-note strong { flex: 0 0 auto; color: #16263e; }
.reputation-panel { overflow: hidden; }
.reputation-toolbar { align-items: flex-end; }
.reputation-toolbar h2 { margin-bottom: 4px; }
.reputation-toolbar p { margin: 0; color: var(--muted); }
.reputation-controls { display: flex; gap: 10px; }
.reputation-controls .search { width: min(320px, 31vw); }
.reputation-list { display: grid; }
.reputation-row {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr) auto;
  gap: 15px;
  align-items: center;
  padding: 17px 20px;
  border-top: 1px solid #e1e8f1;
  background: #fff;
}
.reputation-row:first-child { border-top: 0; }
.reputation-row:hover { background: #f9fbfe; }
.reputation-stage-badge {
  display: inline-flex;
  justify-content: center;
  padding: 6px 9px;
  border: 1px solid #cbd8e8;
  border-radius: 999px;
  background: #f3f6fa;
  color: #526174;
  font-size: 11px;
  font-weight: 800;
}
.stage-positive .reputation-stage-badge { border-color: #bfe3d5; background: #ecf8f3; color: #12694f; }
.stage-concern .reputation-stage-badge { border-color: #efc0bd; background: #fff0ef; color: #9a332e; }
.reputation-copy { display: grid; gap: 4px; min-width: 0; }
.reputation-copy strong { overflow: hidden; color: #14243b; text-overflow: ellipsis; white-space: nowrap; }
.reputation-copy span { overflow: hidden; color: #6b7a90; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.reputation-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; max-width: 560px; }
.mini-action.danger-outline { border-color: #e0aaa6; color: #9a332e; }
html[data-theme="dark"] .reputation-safety-note { border-color: #31445f; background: #0c192b; color: #9fb0c8; }
html[data-theme="dark"] .reputation-safety-note strong { color: #edf3ff; }
html[data-theme="dark"] .reputation-row { border-color: #283a54; background: #101d31; }
html[data-theme="dark"] .reputation-row:hover { background: #14243a; }
html[data-theme="dark"] .reputation-copy strong { color: #eef4ff; }
html[data-theme="dark"] .reputation-copy span { color: #9fb0c8; }
html[data-theme="dark"] .reputation-stage-badge { border-color: #3a4d67; background: #17263c; color: #c5d1e1; }
html[data-theme="dark"] .stage-positive .reputation-stage-badge { border-color: #285c4a; background: #123329; color: #99dbc4; }
html[data-theme="dark"] .stage-concern .reputation-stage-badge { border-color: #74403d; background: #351d1c; color: #ffb6b0; }
html[data-theme="dark"] .mini-action.danger-outline { border-color: #74403d; color: #ffb6b0; }
@media (max-width: 1050px) {
  .reputation-toolbar { align-items: stretch; flex-direction: column; }
  .reputation-controls { width: 100%; }
  .reputation-controls > * { flex: 1; min-width: 0; }
  .reputation-controls .search { width: auto; }
  .reputation-row { grid-template-columns: 94px minmax(0, 1fr); }
  .reputation-actions { grid-column: 1 / -1; justify-content: stretch; max-width: none; }
  .reputation-actions button { flex: 1; }
}
@media (max-width: 620px) {
  .reputation-safety-note { flex-direction: column; gap: 5px; }
  .reputation-controls { flex-direction: column; }
  .reputation-row { grid-template-columns: 1fr; padding: 16px; }
  .reputation-stage-badge { justify-self: start; }
  .reputation-actions { display: grid; grid-template-columns: 1fr; }
}
.operations-root {display:grid;gap:1rem;min-width:0}.operations-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1rem}.operations-stats .panel{display:grid;gap:.4rem;padding:1rem}.operations-stats strong{font-size:1.6rem}.operations-form,.operations-list{padding:1.2rem}.operations-form{display:grid;gap:1rem}.operations-field{display:grid;gap:.35rem;min-width:0}.operations-field input,.operations-field select,.operations-field textarea{width:100%;min-width:0;padding:.7rem;border:1px solid #aab7c7;border-radius:.5rem;background:var(--card,#fff);color:inherit}.operations-field textarea{min-height:5rem}.operations-details{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:.8rem}.operations-row{display:grid;gap:.4rem;padding:.9rem 0;border-top:1px solid #aab7c777;overflow-wrap:anywhere}.operations-row .crm-button{justify-self:start}@media(max-width:600px){.operations-details{grid-template-columns:1fr}.operations-form,.operations-list{padding:1rem}}

html[data-theme="dark"] .operations-field input,html[data-theme="dark"] .operations-field select,html[data-theme="dark"] .operations-field textarea{background:#0a1527;border-color:#334967;color:#edf3ff}
.operations-form h2,.operations-list h2{margin-top:0}.operations-row span{line-height:1.5}.operations-form button[type="submit"]{justify-self:start}
/* Batch 36: daily actions */
.operations-queue{padding:1.2rem;min-width:0}
.operations-queue h2{margin:0 0 .3rem}
.operations-queue-count{margin:.15rem 0 .75rem;opacity:.8}
.operations-queue-warning{padding:.7rem .9rem;border:1px solid #cb8a29;border-radius:.5rem;background:rgba(245,158,11,.12)}
.operations-queue-item{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.85rem .1rem;border-top:1px solid #aab7c777;min-width:0}
.operations-queue-item>div{display:grid;gap:.25rem;min-width:0;overflow-wrap:anywhere}
.operations-queue-item span{line-height:1.4;opacity:.8}
.operations-queue-item.priority-urgent strong{color:#bc3737}
.operations-queue-item.priority-high strong{color:#a45d0a}
html[data-theme="dark"] .operations-queue-item.priority-urgent strong{color:#ff9292}
html[data-theme="dark"] .operations-queue-item.priority-high strong{color:#ffcf80}
@media(max-width:600px){.operations-queue{padding:1rem}.operations-queue-item{align-items:flex-start;flex-direction:column}.operations-queue-item .crm-button{align-self:flex-start}}
/* Batch 39: compact, accessible navigation and balanced Quick Add. */
.crm-sidebar{display:flex;flex-direction:column;gap:3px}
.crm-nav-group{flex:none;border-radius:12px}
.crm-nav-heading{display:flex;align-items:center;justify-content:space-between;min-height:42px;margin:4px 2px;padding:0 12px;border-radius:9px;color:#9badc9;cursor:pointer;list-style:none;font-size:11px;font-weight:800;letter-spacing:.13em;text-transform:uppercase;user-select:none;transition:background .16s,color .16s}
.crm-nav-heading::-webkit-details-marker{display:none}
.crm-nav-heading::marker{content:""}
.crm-nav-heading:hover,.crm-nav-group[open]>.crm-nav-heading{background:rgba(101,150,228,.12);color:#f2f6ff}
.crm-nav-heading:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}
.crm-nav-chevron{font-size:18px;font-weight:500;line-height:1;transition:transform .18s ease}
.crm-nav-group[open] .crm-nav-chevron{transform:rotate(180deg)}
.crm-nav-group .crm-nav{padding:1px 0 8px}
.crm-nav-group:not([open]) .crm-nav{display:none}
.crm-nav-group:has(.crm-link.active)>.crm-nav-heading{color:#f2f6ff}
.crm-sidebar-foot{margin-top:auto}
.quick-create{grid-template-columns:repeat(7,minmax(0,1fr));gap:9px}
.quick-create-label{grid-column:1/-1;place-items:start;padding:0 2px 2px}
@media(max-width:1300px) and (min-width:601px){.quick-create{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:600px){.quick-create{display:flex;gap:8px;overflow-x:auto}.quick-create-label{display:none}}
@media(prefers-reduced-motion:reduce){.crm-nav-heading,.crm-nav-chevron{transition:none}}


/* Batch 61: consistent native select sizing throughout CRM controls. */
.record-form select,
.operations-field select,
.agency-review-form select,
.guidance-preset-actions select,
select.filter,
.schedule-filter select,
.status-select {
  box-sizing: border-box;
  height: 44px;
  min-height: 44px;
  max-width: 100%;
  padding-right: 38px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23526787' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  font: inherit;
  cursor: pointer;
}
.status-select { border-radius: 999px; padding-left: 12px; }
.record-form select:focus-visible,
.operations-field select:focus-visible,
.agency-review-form select:focus-visible,
.guidance-preset-actions select:focus-visible,
select.filter:focus-visible,
.schedule-filter select:focus-visible,
.status-select:focus-visible {
  outline: 2px solid #4c82ec;
  outline-offset: 2px;
}
html[data-theme="dark"] .record-form select,
html[data-theme="dark"] .operations-field select,
html[data-theme="dark"] .agency-review-form select,
html[data-theme="dark"] .guidance-preset-actions select,
html[data-theme="dark"] select.filter,
html[data-theme="dark"] .schedule-filter select,
html[data-theme="dark"] .status-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23c9d8ee' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* More specific form and dark-mode background shorthands reset the indicator's
   repeat AND position in Safari. Keep one arrow at the right of every select. */
select,
.status-select {
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 16px 16px !important;
}
@media (max-width: 600px) {
  .record-form-grid > label, .operations-details > .operations-field { min-width: 0; }
  .record-form select, .operations-field select, .agency-review-form select,
  .guidance-preset-actions select, select.filter, .schedule-filter select { font-size: 16px; }
}

/* Batch 66: tidy mobile business hours and retire the bottom navigation. */
.mobile-bottom-nav { display: none !important; }
.hours-row input[type="time"] {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.hours-row input[type="checkbox"] { accent-color: #3a7cff; }
@media (min-width: 761px) {
  .hours-row {
    grid-template-columns: minmax(100px, 120px) minmax(0, 1fr) 20px minmax(0, 1fr) minmax(95px, auto);
    border-radius: 14px;
  }
  .hours-row input[type="time"] { min-height: 44px; }
}
@media (max-width: 760px) {
  .hours-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
  }
  .hours-row strong, .hours-row .closed-toggle { grid-column: 1 / -1; }
  .hours-row input[type="time"] {
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 46px;
    padding: 8px;
    font-size: 16px;
  }
  .hours-row input[type="checkbox"] { accent-color: #3a7cff; }
}
@media (max-width: 600px) {
  body { padding-bottom: env(safe-area-inset-bottom, 0px); }
}
.field-error { color: #b42318; font-size: .78rem; font-weight: 600; }
.field-error:empty { display: none; }
html[data-theme="dark"] .field-error { color: #ffaaa0; }
.record-form [aria-invalid="true"] { border-color: #d92d20; }
#crm-toast-region { position: fixed; z-index: 1000; bottom: max(16px, env(safe-area-inset-bottom)); right: 16px; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.crm-toast { padding: 12px 16px; border-radius: 10px; background: #7a271a; color: #fff; box-shadow: 0 8px 32px #0004; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.crm-toast.success { background: #075e46; }
.crm-toast.warning { background: #8b4900; }
.record-save-error { margin: 14px 0 0; padding: 12px 14px; border: 1px solid #f97066; border-radius: 9px; background: #fff1f0; color: #8f1d18; font-size: 14px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.record-save-error[hidden] { display: none; }
html[data-theme="dark"] .record-save-error { border-color: #d25854; background: #402423; color: #fff0ed; }
.conversation-consent-notice { grid-column: 1 / -1; padding: 11px 13px; margin: 0; border: 1px solid #e2aa45; border-radius: 9px; background: #fff8e8; color: #7d4300; font-size: 14px; line-height: 1.45; }
.conversation-consent-notice[hidden] { display: none; }
html[data-theme="dark"] .conversation-consent-notice { background: #342a1c; border-color: #986a2a; color: #ffe6a4; }
.ai-lead-analysis { margin: 18px 0; padding: 18px; border: 1px solid #8dbde8; border-radius: 12px; background: #edf7ff; color: #163e61; overflow-wrap: anywhere; }
.ai-lead-analysis h3 { margin: 0 0 10px; font-size: 17px; }
.ai-lead-analysis p { margin: 8px 0; line-height: 1.5; white-space: pre-wrap; }
.ai-lead-analysis .ai-lead-note { font-size: 13px; font-weight: 600; }
.ai-lead-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
html[data-theme="dark"] .ai-lead-analysis { background: #172c3e; border-color: #446c91; color: #e2f1ff; }
