:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161616;
  --bg-subtle: #0f0f0f;
  --surface: #1c1c1c;
  --border: #2e2e2e;
  --border-light: #252525;
  --text: #ececec;
  --text-secondary: #a0a0a8;
  --text-muted: #707078;
  --accent: #ececec;
  --accent-soft: #d4d4d4;
  --on-accent: #111111;
  --row-hover: #252528;
  --focus-border: #4a4a52;
  --focus-ring: rgba(236, 236, 236, 0.08);
  --tint-positive-border: rgba(34, 197, 94, 0.42);
  --tint-positive-gradient: linear-gradient(160deg, rgba(34, 197, 94, 0.38) 0%, rgba(34, 197, 94, 0.16) 55%, rgba(34, 197, 94, 0.08) 100%);
  --tint-positive-text: #111111;
  --tint-positive-muted: #111111;
  --tint-negative-border: rgba(239, 68, 68, 0.42);
  --tint-negative-gradient: linear-gradient(160deg, rgba(239, 68, 68, 0.38) 0%, rgba(239, 68, 68, 0.16) 55%, rgba(239, 68, 68, 0.08) 100%);
  --tint-negative-text: #111111;
  --tint-negative-muted: #111111;
  --tint-neutral-border: rgba(234, 179, 8, 0.42);
  --tint-neutral-gradient: linear-gradient(160deg, rgba(234, 179, 8, 0.34) 0%, rgba(234, 179, 8, 0.14) 55%, rgba(234, 179, 8, 0.07) 100%);
  --tint-neutral-text: #111111;
  --tint-neutral-muted: #111111;
  --tint-label-stroke: 0.45px rgba(255, 255, 255, 0.92);
  --panel-critical-border: var(--tint-negative-border);
  --panel-warning-border: var(--tint-neutral-border);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
  --critical-bg: var(--tint-negative-gradient);
  --critical-text: var(--tint-negative-muted);
  --warning-bg: var(--tint-neutral-gradient);
  --warning-text: var(--tint-neutral-muted);
  --safe-bg: var(--tint-positive-gradient);
  --safe-text: var(--tint-positive-muted);
  --reminder-critical-bg: var(--tint-negative-gradient);
  --reminder-warning-bg: var(--tint-neutral-gradient);
  --reminder-safe-bg: var(--tint-positive-gradient);
  --reminder-window-30-border: rgba(190, 18, 60, 0.5);
  --reminder-window-30-gradient: linear-gradient(160deg, rgba(225, 29, 72, 0.46) 0%, rgba(225, 29, 72, 0.22) 55%, rgba(225, 29, 72, 0.1) 100%);
  --reminder-window-30-accent: #be123c;
  --reminder-window-60-border: rgba(202, 138, 4, 0.55);
  --reminder-window-60-gradient: linear-gradient(160deg, rgba(234, 179, 8, 0.58) 0%, rgba(250, 204, 21, 0.28) 55%, rgba(254, 240, 138, 0.12) 100%);
  --reminder-window-60-accent: #a16207;
  --reminder-window-90-border: rgba(29, 78, 216, 0.5);
  --reminder-window-90-gradient: linear-gradient(160deg, rgba(37, 99, 235, 0.44) 0%, rgba(59, 130, 246, 0.22) 55%, rgba(147, 197, 253, 0.12) 100%);
  --reminder-window-90-accent: #2563eb;
  --reminder-window-safe-border: rgba(22, 163, 74, 0.5);
  --reminder-window-safe-gradient: linear-gradient(160deg, rgba(34, 197, 94, 0.44) 0%, rgba(34, 197, 94, 0.2) 55%, rgba(134, 239, 172, 0.12) 100%);
  --reminder-window-safe-accent: #16a34a;
  --reminder-window-text: #111111;
  --comm-teal: #0d9488;
  --comm-blue: #2563eb;
  --comm-blue-bg: rgba(37, 99, 235, 0.12);
  --comm-blue-text: #1d4ed8;
  --comm-teal-bg: rgba(13, 148, 136, 0.12);
  --comm-teal-text: #0f766e;
  --comm-row-responded: rgba(34, 197, 94, 0.11);
  --comm-row-responded-detail: rgba(34, 197, 94, 0.17);
  --comm-row-contacted: rgba(234, 179, 8, 0.12);
  --comm-row-contacted-detail: rgba(234, 179, 8, 0.18);
  --comm-row-no-response: rgba(239, 68, 68, 0.1);
  --comm-row-no-response-detail: rgba(239, 68, 68, 0.16);
  --comm-status-responded-bg: rgba(34, 197, 94, 0.2);
  --comm-status-responded-text: #15803d;
  --comm-status-contacted-bg: rgba(234, 179, 8, 0.22);
  --comm-status-contacted-text: #a16207;
  --comm-status-no-response-bg: rgba(239, 68, 68, 0.18);
  --comm-status-no-response-text: #b91c1c;
  --comm-status-completed-bg: rgba(34, 197, 94, 0.22);
  --comm-status-completed-text: #15803d;
  --comm-status-need-re-written-bg: rgba(244, 114, 182, 0.22);
  --comm-status-need-re-written-text: #be185d;
  --comm-status-csr-notified-bg: rgba(234, 179, 8, 0.22);
  --comm-status-csr-notified-text: #a16207;
  --comm-status-customer-notified-bg: rgba(59, 130, 246, 0.2);
  --comm-status-customer-notified-text: #1d4ed8;
  --comm-row-completed: rgba(34, 197, 94, 0.11);
  --comm-row-completed-detail: rgba(34, 197, 94, 0.17);
  --menu-bg: #1a1a1a;
  --menu-border: #333333;
  --menu-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  --radius: 12px;
  --radius-btn: 10px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  color-scheme: light;
  --bg-subtle: #f7f7f8;
  --bg: #ffffff;
  --surface: #ffffff;
  --border: #e8e8ec;
  --border-light: #f0f0f3;
  --text: #111111;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --accent: #111111;
  --accent-soft: #2d2d35;
  --on-accent: #ffffff;
  --row-hover: #f3f3f6;
  --focus-border: #c4c4cf;
  --focus-ring: rgba(17, 17, 17, 0.06);
  --tint-positive-text: #0a2e18;
  --tint-positive-muted: #14532d;
  --tint-negative-text: #450a0a;
  --tint-negative-muted: #991b1b;
  --tint-neutral-text: #451a03;
  --tint-neutral-muted: #92400e;
  --tint-label-stroke: 0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --menu-bg: #ffffff;
  --menu-border: #e8e8ec;
  --menu-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --comm-blue-text: #1d4ed8;
  --comm-teal-text: #0f766e;
  --comm-status-responded-text: #15803d;
  --comm-status-contacted-text: #a16207;
  --comm-status-no-response-text: #b91c1c;
}

[data-theme="light"] body {
  color: var(--text);
  font-weight: 600;
}

[data-theme="light"] :is(
  .page-title,
  .login-title,
  .settings-section-title,
  .settings-row-label,
  .my-action-required-header h2,
  .action-required-header h2,
  .ap-nav-item.active
) {
  color: #111111;
  font-weight: 700;
}

[data-theme="light"] .ap-nav-item {
  color: var(--text-secondary);
  font-weight: 600;
}

[data-theme="light"] .data-table th {
  color: #111111;
  font-weight: 700;
}

[data-theme="light"] .data-table td {
  color: var(--text-secondary);
  font-weight: 600;
}

[data-theme="light"] .data-table td:first-child {
  color: #111111;
  font-weight: 700;
}

[data-theme="light"] .policy-badge {
  background: #eff6ff;
  color: #1e40af;
  font-weight: 700;
}

[data-theme="light"] .client-tier-gold {
  color: #92400e;
}

[data-theme="light"][data-theme-preference="light"] {
  --bg-subtle: #ffffff;
}

[data-theme="light"][data-theme-preference="system"] {
  --bg-subtle: #f7f7f8;
}

[data-theme="dark"] :where(
  .status-lapsed,
  .status-critical,
  .status-warning,
  .status-active,
  .stage-escalation-due,
  .stage-handled,
  .stage-responded,
  .retention-badge,
  .sort-pill.active,
  .filter-chip.active,
  .my-action-required-header h2,
  .action-required-header h2,
  .ap-shell .kpi-card.kpi-trend-positive .kpi-value,
  .ap-shell .kpi-card.kpi-trend-positive .kpi-desc,
  .ap-shell .kpi-card.kpi-trend-negative .kpi-value,
  .ap-shell .kpi-card.kpi-trend-negative .kpi-desc,
  .ap-shell .kpi-card.kpi-trend-neutral .kpi-value,
  .ap-shell .kpi-card.kpi-trend-neutral .kpi-desc,
  .import-status.error,
  .import-status.success
),
[data-theme="light"] :where(
  .status-lapsed,
  .status-critical,
  .status-warning,
  .status-active,
  .stage-escalation-due,
  .stage-handled,
  .stage-responded,
  .retention-badge,
  .sort-pill.active,
  .filter-chip.active,
  .my-action-required-header h2,
  .action-required-header h2,
  .ap-shell .kpi-card.kpi-trend-positive .kpi-value,
  .ap-shell .kpi-card.kpi-trend-positive .kpi-desc,
  .ap-shell .kpi-card.kpi-trend-negative .kpi-value,
  .ap-shell .kpi-card.kpi-trend-negative .kpi-desc,
  .ap-shell .kpi-card.kpi-trend-neutral .kpi-value,
  .ap-shell .kpi-card.kpi-trend-neutral .kpi-desc,
  .import-status.error,
  .import-status.success
) {
  font-weight: 700;
  -webkit-text-stroke: var(--tint-label-stroke);
  paint-order: stroke fill;
}

.tint-surface {
  position: relative;
  isolation: isolate;
  background: var(--surface);
  overflow: hidden;
}

.tint-surface::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
}

.tint-surface > * {
  position: relative;
  z-index: 1;
}

.tint-positive {
  border-color: var(--tint-positive-border);
}

.tint-positive::before {
  background: var(--tint-positive-gradient);
}

.tint-negative {
  border-color: var(--tint-negative-border);
}

.tint-negative::before {
  background: var(--tint-negative-gradient);
}

.tint-neutral {
  border-color: var(--tint-neutral-border);
}

.tint-neutral::before {
  background: var(--tint-neutral-gradient);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-subtle);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: min(100%, 24rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.75rem;
}

.login-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 1rem 0 0.35rem;
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 1.25rem;
}

.login-form {
  display: grid;
  gap: 0.85rem;
}

.form-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font: inherit;
  background: var(--surface);
}

.form-field textarea {
  resize: vertical;
  min-height: 6rem;
  line-height: 1.45;
}

.form-error {
  font-size: 0.8125rem;
  color: var(--critical-text);
  margin: 0;
  min-height: 1.1rem;
}

.login-submit { width: 100%; }

.login-demo-hint {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.login-demo-hint summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.login-demo-hint ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

[hidden] { display: none !important; }

.ap-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-subtle);
}

.ap-sidebar {
  width: 15.75rem;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.85rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.ap-sidebar-brand {
  padding: 0.25rem 0.5rem 1.25rem;
  margin-bottom: 0.5rem;
}

.ap-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.ap-nav-item {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border-radius: var(--radius-btn);
  padding: 0.55rem 0.75rem;
  text-decoration: none;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.ap-nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.ap-nav-item.active {
  background: var(--bg-subtle);
  color: var(--text);
  font-weight: 600;
}

.ap-sidebar-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 1rem;
  margin-top: auto;
  display: grid;
  gap: 0.65rem;
  flex-shrink: 0;
}

.ap-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ap-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.75rem 2rem 0;
}

.ap-topbar .page-title {
  margin-top: 0;
}

.ap-content {
  padding: 1.25rem 2rem 2rem;
  flex: 1;
}

.clients-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.clients-subtab {
  flex: 1 1 9rem;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 800;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.clients-subtab:hover,
.clients-subtab:focus-visible {
  color: var(--text);
  background: var(--bg-subtle);
  outline: none;
}

.clients-subtab.active {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.clients-view-panel[hidden] {
  display: none !important;
}

.ap-content > .import-status {
  margin-bottom: 0.75rem;
}

.brand-lockup {
  display: inline-block;
  line-height: 0;
  margin: 0 0 0.65rem;
  text-decoration: none;
}

.brand-lockup--centered {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.brand-logo {
  display: block;
  width: min(100%, 11rem);
  height: auto;
}

[data-theme="dark"] .brand-logo {
  filter: brightness(0) invert(1);
  opacity: 0.94;
}

.ap-sidebar-brand .brand-lockup {
  margin-bottom: 0;
}

.ap-sidebar-brand .brand-logo {
  width: min(100%, 9.5rem);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0.5rem 0 0;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.session-note {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0;
}

.job-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  max-width: 18rem;
  margin: 0;
  text-align: right;
}

.btn-sign-out {
  width: 100%;
}

.ap-sidebar-footer .session-note {
  line-height: 1.4;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-input {
  width: min(100%, 16rem);
  padding: 0.55rem 0.75rem 0.55rem 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font: inherit;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239b9ba7' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 0.7rem center;
}

.search-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.csr-filter-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.csr-filter-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.csr-filter-select {
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
}

.tier-filter-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.tier-filter-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.tier-filter-select {
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
}

.window-filter-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.window-filter-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.window-filter-select {
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
}

.my-action-required-panel {
  position: relative;
  isolation: isolate;
  background: var(--surface);
  overflow: hidden;
  border: 1px solid var(--reminder-window-30-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.my-action-required-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: var(--reminder-window-30-gradient);
  pointer-events: none;
}

.my-action-required-panel > * {
  position: relative;
  z-index: 1;
}

.my-action-required-header h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  color: var(--tint-negative-text);
}

.my-action-required-desc {
  margin: 0 0 0.85rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.my-action-required-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.my-action-required-item {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-btn);
  overflow: hidden;
}

.my-action-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: background 0.15s var(--ease);
}

.my-action-toggle:hover {
  background: var(--bg-subtle);
}

.my-action-toggle:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.my-action-chevron {
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.15s var(--ease);
}

.my-action-required-item.is-expanded .my-action-chevron {
  transform: rotate(-135deg);
  margin-top: 0.2rem;
}

.my-action-contact-log {
  display: none;
  gap: 0.65rem;
  padding: 0 0.85rem 0.85rem;
}

.my-action-required-item.is-expanded .my-action-contact-log {
  display: grid;
  padding-top: 0.15rem;
  border-top: 1px solid var(--tint-negative-border);
}

.my-action-required-item.is-expanded .my-action-toggle {
  border-bottom: 1px solid var(--tint-negative-border);
}

.my-action-required-name {
  font-size: 0.875rem;
  font-weight: 700;
}

.my-action-handled-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tint-positive-text);
  background: var(--tint-positive-gradient);
  border: 1px solid var(--tint-positive-border);
  vertical-align: middle;
}

.my-action-required-detail {
  margin: 0.65rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.my-action-saved-notes {
  display: grid;
  gap: 0.45rem;
}

.my-action-saved-note-group {
  display: grid;
  gap: 0;
}

.my-action-saved-note-group.has-edit-history .my-action-saved-note {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.my-action-saved-notes-header,
.my-action-saved-note {
  display: grid;
  grid-template-columns: minmax(0, 11.5rem) 1fr auto;
  align-items: center;
  column-gap: 0.75rem;
}

.my-action-saved-notes-header {
  padding: 0 0.65rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.my-action-saved-header-description {
  text-align: center;
}

.my-action-saved-header-actions {
  text-align: right;
}

.my-action-saved-note {
  padding: 0.5rem 0.65rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-btn);
  font-size: 0.75rem;
  line-height: 1.4;
}

.my-action-saved-note.is-editing {
  border-color: var(--border);
  box-shadow: inset 0 0 0 1px var(--border-light);
}

.my-action-saved-text {
  min-width: 0;
  color: var(--text);
  font-weight: 600;
  text-align: center;
}

.my-action-saved-meta {
  min-width: 0;
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
}

.my-action-saved-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
}

.btn-note-action {
  min-height: 0;
  padding: 0.2rem 0.5rem;
  font-size: 0.6875rem;
}

.my-action-saved-note.is-edited {
  border-color: color-mix(in srgb, var(--accent) 25%, var(--border-light));
}

.my-action-note-history {
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 var(--radius-btn) var(--radius-btn);
  background: var(--surface);
  overflow: hidden;
}

.my-action-note-history-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.4rem 0.65rem;
  border: none;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.my-action-note-history-toggle:hover {
  background: color-mix(in srgb, var(--bg-subtle) 70%, var(--border-light));
}

.my-action-note-history-toggle:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.my-action-note-history-chevron {
  flex-shrink: 0;
  width: 0.35rem;
  height: 0.35rem;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s var(--ease);
}

.my-action-note-history.is-expanded .my-action-note-history-chevron {
  transform: rotate(45deg);
  margin-top: -0.1rem;
}

.my-action-note-history-panel {
  display: grid;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem 0.55rem;
  border-top: 1px solid var(--border-light);
}

.my-action-note-history-item {
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-btn);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
}

.my-action-note-history-when {
  margin: 0 0 0.15rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-muted);
}

.my-action-note-history-detail {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.btn-note-action--danger {
  color: var(--tint-negative-text);
  border-color: color-mix(in srgb, var(--tint-negative-text) 35%, var(--border));
}

.my-action-contact-form {
  display: grid;
  gap: 0.55rem;
}

.my-action-form-row {
  display: grid;
  gap: 0.25rem;
}

.my-action-form-inline {
  grid-template-columns: minmax(9rem, 11rem) minmax(0, 1fr);
  align-items: end;
  gap: 0.65rem;
}

.my-action-field-label {
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.my-action-note {
  width: 100%;
  min-height: 2.35rem;
  resize: vertical;
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 0.45rem 0.6rem;
}

.my-action-note:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.my-action-date {
  width: 100%;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 0.4rem 0.55rem;
}

.my-action-date:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.contact-method-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.contact-method-pill {
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.contact-method-pill:hover {
  border-color: #d4d4dc;
  color: var(--text);
}

.contact-method-pill.active {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}

.contact-log-type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.contact-log-type-pill {
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.contact-log-type-pill:hover {
  border-color: #d4d4dc;
  color: var(--text);
}

.contact-log-type-pill.active {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}

.my-action-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

.btn-quick-action {
  padding: 0.45rem 0.75rem;
  font-size: 0.8125rem;
  text-decoration: none;
}

.btn-log-contact {
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
}

.my-action-required-empty {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.pending-policy-panel {
  position: relative;
  isolation: isolate;
  background: var(--surface);
  overflow: hidden;
  border: 1px solid var(--reminder-window-60-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.pending-policy-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: var(--reminder-window-60-gradient);
  pointer-events: none;
}

.pending-policy-panel > * {
  position: relative;
  z-index: 1;
}

.pending-policy-header h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  color: var(--tint-warning-text);
}

.pending-policy-desc {
  margin: 0 0 0.85rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.pending-policy-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.pending-policy-item {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-btn);
  overflow: hidden;
}

.pending-policy-item.is-expanded .my-action-chevron {
  transform: rotate(-135deg);
  margin-top: 0.2rem;
}

.pending-policy-item.is-expanded .my-action-contact-log {
  display: grid;
  padding-top: 0.15rem;
  border-top: 1px solid var(--reminder-window-60-border);
}

.pending-policy-item.is-expanded .my-action-toggle {
  border-bottom: 1px solid var(--reminder-window-60-border);
}

.pending-policy-empty {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.policy-resolution-actions {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.policy-resolution-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.btn-mark-handled {
  flex-shrink: 0;
  padding: 0.45rem 0.8rem;
  font-size: 0.8125rem;
}

.action-required-panel {
  position: relative;
  isolation: isolate;
  background: var(--surface);
  overflow: hidden;
  border: 1px solid var(--tint-neutral-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.action-required-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: var(--tint-neutral-gradient);
  pointer-events: none;
}

.action-required-panel > * {
  position: relative;
  z-index: 1;
}

.action-required-header h2 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
  color: var(--tint-neutral-text);
}

.action-required-desc {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.action-required-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.action-required-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  color: var(--text);
  align-items: baseline;
}

.action-required-item span {
  color: var(--text-secondary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-btn);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.btn-primary:hover { background: var(--accent-soft); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover { background: var(--bg-subtle); }

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.import-wrap { position: relative; }

.toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.client-form-dialog {
  width: min(100%, 40rem);
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--text);
  overflow: hidden;
}

.client-form-dialog[open] {
  display: flex;
  flex-direction: column;
}

.client-form-dialog::backdrop {
  background: rgb(15 23 42 / 0.45);
}

.client-info-dialog {
  width: min(100%, 44rem);
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--text);
  overflow: hidden;
}

.client-policies-summary {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

.client-policies-summary-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.client-policies-summary-title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.client-policies-summary-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.client-policies-summary-table-wrap {
  overflow-x: auto;
}

.client-policies-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.client-policies-summary-table th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.client-policies-summary-table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.client-policies-summary-table tbody tr:last-child td {
  border-bottom: none;
}

.client-policies-summary-table tbody tr.is-primary td:first-child {
  font-weight: 600;
}

.client-policies-summary-policy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.client-policies-summary-policy-type {
  font-weight: 600;
  color: var(--text);
}

.client-policies-summary-policy-number {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.client-policies-summary-days--critical {
  color: var(--tint-negative-muted, #b91c1c);
  font-weight: 600;
}

.client-policies-summary-days--warning {
  color: #b45309;
  font-weight: 600;
}

.client-policies-summary-days--upcoming {
  color: #1d4ed8;
  font-weight: 600;
}

.client-info-dialog::backdrop {
  background: rgb(15 23 42 / 0.35);
}

.client-info-panel {
  display: grid;
  gap: 0.85rem;
  padding: 1.1rem 1.25rem 1.25rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.client-info-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.75rem;
}

.client-info-field--full {
  grid-column: 1 / -1;
}

.client-info-expiration-preview {
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--safe-bg);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius);
}

.client-info-expiration-preview:empty {
  display: none;
}

.client-info-policy-block {
  margin: 0;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted, #f8fafc);
}

.client-info-policy-legend {
  padding: 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.client-info-policy-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.client-info-policy-block-header .client-info-policy-legend {
  margin: 0;
}

.client-info-additional-policies {
  display: grid;
  gap: 0.65rem;
}

.client-info-policy-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.client-info-policy-limit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.client-info-form-grid .form-field span {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.client-info-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.client-info-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.client-form {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.client-form-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.client-form-title {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 700;
}

.client-form-desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.client-form-close {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

.client-form-close:hover,
.client-form-close:focus-visible {
  color: var(--text);
  outline: none;
}

.client-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
}

.client-form-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.5rem;
}

.client-form-section-title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.client-form-grid--nested {
  margin: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.client-form-field--full {
  grid-column: 1 / -1;
}

.client-form-grid .client-info-additional-policies {
  display: grid;
  gap: 0.65rem;
}

.form-field--full {
  grid-column: 1 / -1;
}

.client-form-grid .form-field span {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.client-form-grid .form-field input,
.client-form-grid .form-field select,
.client-form-grid .form-field textarea,
.client-form .form-field textarea,
.client-form .form-field select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font: inherit;
  background: var(--surface);
  color: var(--text);
}

.client-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.client-form .form-error {
  margin: 0;
}

.import-status {
  font-size: 0.8125rem;
  margin: 0 0 1rem;
  min-height: 1.25rem;
}

.import-status.error { color: var(--tint-negative-muted); }
.import-status.success { color: var(--tint-positive-muted); }

.table-card,
.reminders-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.table-wrap,
.reminders-table-wrap {
  max-width: 100%;
  overflow: visible;
}

.clients-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-raised, var(--surface));
}

.clients-page-status {
  font-size: 0.8125rem;
  color: var(--text-muted);
  min-width: 10rem;
  text-align: center;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

/* border-collapse:collapse breaks position:sticky on th — use separate for scroll-pinned headers */
#clients-table,
.comm-log-table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  width: 100%;
}

/* Shared column widths — class-based so admin-only columns can be omitted */
.col-row-num { width: 2.75rem; }
.col-client { width: 22%; }
.col-csr { width: 9.5rem; }
.col-agent { width: 11.5rem; }
.col-next-reminder { width: 9.5rem; }
.col-policies { width: 8.5rem; }
.col-status { width: 10.5rem; }
.col-last-contact { width: 9.5rem; }
.col-method { width: 11rem; }
.col-tier { width: 5.75rem; }
.col-policy { width: 9rem; }
.col-policy-status { width: 8.5rem; }
.col-expiration { width: 7.5rem; }
.col-days-left { width: 5.75rem; }
.col-renewal-stage { width: 10.5rem; }
.col-response { width: 8.5rem; }

#clients-table .col-client { width: 28%; }
#clients-table .col-tier { width: 6.5rem; }
#clients-table .col-policy { width: 10rem; }
#clients-table .col-policy-status { width: 9rem; }
#clients-table .col-expiration { width: 8rem; }
#clients-table .col-days-left { width: 6.5rem; }
#clients-table .col-status { width: 10rem; }

.hs-policy-status-badge {
  display: inline-block;
  max-width: 100%;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2, var(--bg-elevated, transparent));
  color: var(--text-muted, var(--muted));
  font-size: 0.75rem;
  font-weight: 560;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.data-table th.result-row-num-th,
.data-table td.result-row-num {
  width: 2.75rem;
  min-width: 2.75rem;
  max-width: 2.75rem;
  padding-left: 0.65rem;
  padding-right: 0.35rem;
  text-align: right;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

.data-table th.result-row-num-th {
  text-transform: none;
  letter-spacing: normal;
}

.data-table td.col-days-left,
.data-table th.col-days-left .sortable-th-btn {
  text-align: right;
}

.result-row-num {
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  flex-shrink: 0;
}

.my-action-toggle .result-row-num {
  width: 1.75rem;
  margin-right: 0.15rem;
  text-align: right;
}

.my-action-toggle .my-action-required-name {
  flex: 1;
  min-width: 0;
}

.action-required-item .result-row-num {
  width: 1.75rem;
  text-align: right;
}

#clients-table thead th,
.comm-log-table thead th {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 5;
  background-color: var(--bg-subtle);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 1px 0 var(--border);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

tbody tr:hover:not(.empty-row):not(.expiring-critical):not(.expiring-warning):not(.expiring-upcoming):not(.expiring-safe):not([class*='reminder-window-']):not(.reminder-tier-critical):not(.reminder-tier-warning):not(.reminder-tier-upcoming):not(.reminder-tier-safe) {
  background: var(--row-hover) !important;
}

/* Shared renewal-window row tints — clients table + dashboard reminders */
tr.expiring-critical,
.comm-log-client-row.reminder-window-30,
.reminders-table tbody tr.reminder-tier-critical,
.reminders-table tbody tr.reminder-client-row.reminder-tier-critical {
  background: var(--reminder-window-30-gradient) !important;
  box-shadow: inset 4px 0 0 var(--reminder-window-30-accent);
}

tr.expiring-warning,
.comm-log-client-row.reminder-window-60,
.reminders-table tbody tr.reminder-tier-warning,
.reminders-table tbody tr.reminder-client-row.reminder-tier-warning {
  background: var(--reminder-window-60-gradient) !important;
  box-shadow: inset 4px 0 0 var(--reminder-window-60-accent);
}

tr.expiring-upcoming,
.comm-log-client-row.reminder-window-90,
.reminders-table tbody tr.reminder-tier-upcoming,
.reminders-table tbody tr.reminder-client-row.reminder-tier-upcoming {
  background: var(--reminder-window-90-gradient) !important;
  box-shadow: inset 4px 0 0 var(--reminder-window-90-accent);
}

tr.expiring-safe,
.reminders-table tbody tr.reminder-tier-safe,
.reminders-table tbody tr.reminder-client-row.reminder-tier-safe {
  background: var(--reminder-window-safe-gradient) !important;
  box-shadow: inset 4px 0 0 var(--reminder-window-safe-accent);
}

tr.expiring-critical:hover:not(.empty-row),
.comm-log-client-row.reminder-window-30:hover,
.reminders-table tbody tr.reminder-tier-critical:hover:not(.empty-row),
.reminders-table tbody tr.reminder-client-row.reminder-tier-critical:hover:not(.empty-row) {
  filter: brightness(1.03);
  box-shadow: inset 4px 0 0 var(--reminder-window-30-accent), inset 0 0 0 1px rgba(17, 17, 17, 0.08);
}

tr.expiring-warning:hover:not(.empty-row),
.comm-log-client-row.reminder-window-60:hover,
.reminders-table tbody tr.reminder-tier-warning:hover:not(.empty-row),
.reminders-table tbody tr.reminder-client-row.reminder-tier-warning:hover:not(.empty-row) {
  filter: brightness(1.03);
  box-shadow: inset 4px 0 0 var(--reminder-window-60-accent), inset 0 0 0 1px rgba(17, 17, 17, 0.08);
}

tr.expiring-upcoming:hover:not(.empty-row),
.comm-log-client-row.reminder-window-90:hover,
.reminders-table tbody tr.reminder-tier-upcoming:hover:not(.empty-row),
.reminders-table tbody tr.reminder-client-row.reminder-tier-upcoming:hover:not(.empty-row) {
  filter: brightness(1.03);
  box-shadow: inset 4px 0 0 var(--reminder-window-90-accent), inset 0 0 0 1px rgba(17, 17, 17, 0.08);
}

tr.expiring-safe:hover:not(.empty-row),
.reminders-table tbody tr.reminder-tier-safe:hover:not(.empty-row),
.reminders-table tbody tr.reminder-client-row.reminder-tier-safe:hover:not(.empty-row) {
  filter: brightness(1.03);
  box-shadow: inset 4px 0 0 var(--reminder-window-safe-accent), inset 0 0 0 1px rgba(17, 17, 17, 0.08);
}

.reminder-client-row {
  cursor: pointer;
  transition: filter 0.15s var(--ease);
}

.reminders-table tbody tr.reminder-client-row td {
  padding: 0.55rem 1rem;
  font-size: 0.8125rem;
}

.reminder-client-row:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.reminder-client-name-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.reminder-client-name {
  flex: 1;
  min-width: 0;
}

.reminder-expand-label {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.reminder-client-row.is-expanded .reminder-expand-label {
  color: var(--text-secondary);
}

.reminder-chevron {
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s var(--ease);
}

.reminder-client-row.is-expanded .reminder-chevron {
  transform: rotate(45deg);
  margin-top: -0.15rem;
}

.reminder-detail-row {
  display: none;
}

.reminder-detail-row.is-expanded {
  display: table-row;
}

.reminder-detail-row td {
  padding: 0;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.reminder-detail-panel {
  padding: 0.5rem 1rem 0.75rem 1.75rem;
}

.reminder-detail-table {
  font-size: 0.8125rem;
}

.reminder-detail-table th {
  padding: 0.45rem 0.75rem;
  font-size: 0.6875rem;
}

.reminder-detail-table td {
  padding: 0.5rem 0.75rem;
}

.reminder-detail-table tbody tr.reminder-tier-critical {
  background: var(--reminder-window-30-gradient) !important;
}

.reminder-detail-table tbody tr.reminder-tier-warning {
  background: var(--reminder-window-60-gradient) !important;
}

.reminder-detail-table tbody tr.reminder-tier-safe {
  background: var(--reminder-window-safe-gradient) !important;
}

.reminder-detail-table tbody tr.reminder-tier-critical:hover,
.reminder-detail-table tbody tr.reminder-tier-warning:hover,
.reminder-detail-table tbody tr.reminder-tier-safe:hover {
  filter: brightness(1.06);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.status-lapsed,
.status-critical {
  background: var(--tint-negative-gradient);
  color: var(--tint-negative-text);
  border-color: var(--tint-negative-border);
  font-weight: 700;
}

.status-warning {
  background: var(--tint-neutral-gradient);
  color: var(--tint-neutral-text);
  border-color: var(--tint-neutral-border);
  font-weight: 700;
}

.status-active {
  background: var(--tint-positive-gradient);
  color: var(--tint-positive-text);
  border-color: var(--tint-positive-border);
  font-weight: 700;
}

.stage-badge {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.stage-escalation-due {
  background: var(--tint-neutral-gradient);
  color: var(--tint-neutral-text);
  border-color: var(--tint-neutral-border);
}

.stage-handled,
.stage-responded,
.stage-agent-contacted,
.stage-completed {
  background: var(--tint-positive-gradient);
  color: var(--tint-positive-text);
  border-color: var(--tint-positive-border);
}

.stage-responded {
  background: var(--tint-info-gradient, linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%));
  color: var(--tint-info-text, #1e40af);
  border-color: var(--tint-info-border, #93c5fd);
}

.stage-agent-contacted {
  background: var(--tint-positive-gradient);
  color: var(--tint-positive-text);
  border-color: var(--tint-positive-border);
}

.response-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.response-badge--urgent {
  background: var(--tint-negative-gradient);
  color: var(--tint-negative-text);
  border-color: var(--tint-negative-border);
}

.response-badge--warning {
  background: var(--tint-neutral-gradient);
  color: var(--tint-neutral-text);
  border-color: var(--tint-neutral-border);
}

.response-badge--success {
  background: var(--tint-positive-gradient);
  color: var(--tint-positive-text);
  border-color: var(--tint-positive-border);
}

.response-badge--info {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

.response-badge--neutral {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-color: var(--border);
}

.client-name-cell {
  min-width: 10rem;
}

.client-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
}

.client-info-trigger {
  display: inline;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}

.client-info-trigger:hover strong,
.client-info-trigger:focus-visible strong {
  color: var(--accent);
}

.client-info-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
  border-radius: 4px;
}

.client-history-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: inherit;
}

.client-history-toggle:hover,
.client-history-toggle:focus-visible {
  background: var(--bg-subtle);
  outline: none;
}

.client-history-toggle:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}

.client-history-chevron {
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s var(--ease);
}

.client-row.is-history-expanded .client-history-chevron {
  transform: rotate(45deg);
  margin-top: -0.15rem;
}

.client-history-row {
  display: none;
}

.client-history-row.is-expanded {
  display: table-row;
}

.client-history-row td {
  padding: 0;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  width: 100%;
}

.client-history-panel {
  padding: 0.5rem 0.75rem 0.65rem;
  width: 100%;
  box-sizing: border-box;
}

.client-history-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.45rem;
}

.client-history-title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
}

.client-history-current {
  margin: 0;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.client-history-empty {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
}

.client-audit-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.client-audit-table {
  width: 100%;
  table-layout: fixed;
  font-size: 0.75rem;
}

.client-audit-table th {
  padding: 0.35rem 0.5rem;
  font-size: 0.625rem;
  white-space: nowrap;
}

.client-audit-table td {
  padding: 0.4rem 0.5rem;
  vertical-align: top;
  line-height: 1.35;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.client-audit-table th:nth-child(1),
.client-audit-table td:nth-child(1) { width: 6.5rem; }

.client-audit-table th:nth-child(2),
.client-audit-table td:nth-child(2) { width: 9.5rem; }

.client-audit-table th:nth-child(3),
.client-audit-table td:nth-child(3) { width: 16%; }

.client-audit-table th:nth-child(4),
.client-audit-table td:nth-child(4) { width: 34%; }

.client-audit-table th:nth-child(5),
.client-audit-table td:nth-child(5) { width: 24%; }

.client-audit-type {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.client-audit-row--reminder .client-audit-type {
  background: var(--tint-neutral-gradient);
  color: var(--tint-neutral-text);
  border-color: var(--tint-neutral-border);
}

.client-audit-row--escalation .client-audit-type {
  background: var(--tint-neutral-gradient);
  color: var(--tint-neutral-text);
  border-color: var(--tint-neutral-border);
}

.client-audit-row--contact .client-audit-type {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent);
}

.client-audit-row--client-responded .client-audit-type {
  background: var(--tint-positive-gradient);
  color: var(--tint-positive-text);
  border-color: var(--tint-positive-border);
}

.client-audit-row--agent-contacted .client-audit-type,
.client-audit-row--handled .client-audit-type {
  background: var(--tint-positive-gradient);
  color: var(--tint-positive-text);
  border-color: var(--tint-positive-border);
}

.client-audit-notes {
  color: var(--text-muted);
  font-size: 0.6875rem;
}

.client-audit-table time {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.6875rem;
}

.renewed-policy-expiration-preview {
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  background: var(--safe-bg);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius);
}

.action-confirm-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: calc(100vh - 2rem);
  min-height: 0;
  padding: 1.25rem;
  box-sizing: border-box;
  overflow: hidden;
}

.action-confirm-form .client-form-header {
  flex-shrink: 0;
}

.action-confirm-form .form-error {
  flex-shrink: 0;
}

.action-confirm-form .action-confirm-field {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.action-confirm-form .client-form-actions {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.response-action-bar--undo {
  margin-top: 0.65rem;
}

.btn-response-action--undo {
  border-color: var(--border);
}

.response-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.response-action-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.response-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
}

.btn-response-action--client {
  border-color: #93c5fd;
}

.policy-badge {
  display: inline-flex;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #1e293b;
  color: #93c5fd;
}

.client-tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.client-tier-vip {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
  font-weight: 700;
}

.client-tier-diamond {
  background: #2e1065;
  color: #c4b5fd;
  border-color: #5b21b6;
}

.client-tier-gold {
  background: #3d3510;
  color: var(--tint-neutral-muted);
  border-color: rgba(234, 179, 8, 0.42);
}

.client-tier-silver {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-color: var(--border);
  font-weight: 500;
}

.sortable-th {
  padding: 0;
}

.sortable-th-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: none;
  background: none;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.sortable-th.sort-active .sortable-th-btn {
  color: var(--text);
}

.sort-indicator {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.csr-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  white-space: nowrap;
}

.csr-badge--unassigned {
  color: var(--text-muted);
  font-weight: 500;
}

.csr-select {
  font-size: 0.8125rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
  max-width: 10rem;
}

.workflow-status-select {
  font-size: 0.8125rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
  max-width: 11rem;
}

.workflow-status-select--dialog {
  width: 100%;
  max-width: none;
  margin-top: 0.35rem;
}

.workflow-status-cell {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.workflow-correct-btn {
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: 0.15rem 0.35rem;
  color: var(--text-muted);
}

.action-confirm-field {
  margin: 0.75rem 0 0.25rem;
  display: grid;
  gap: 0.75rem;
}

.action-confirm-note-field {
  display: grid;
  gap: 0.35rem;
}

.action-confirm-contact-field,
.action-confirm-direction-field {
  display: grid;
  gap: 0.35rem;
}

.action-confirm-note {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 0.45rem 0.6rem;
  box-sizing: border-box;
}

.action-confirm-note:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.client-history-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.client-delete-btn {
  flex-shrink: 0;
}

.handled-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  cursor: pointer;
  user-select: none;
}

.handled-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.85rem 0 1.75rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.legend-swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 3px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.legend-swatch.critical {
  background: var(--reminder-window-30-gradient);
  border: 1px solid var(--reminder-window-30-border);
}

.legend-swatch.warning {
  background: var(--reminder-window-60-gradient);
  border: 1px solid var(--reminder-window-60-border);
}

.legend-swatch.upcoming {
  background: var(--reminder-window-90-gradient);
  border: 1px solid var(--reminder-window-90-border);
}

.legend-swatch.safe {
  background: var(--reminder-window-safe-gradient);
  border: 1px solid var(--reminder-window-safe-border);
}

.reminders-section { margin-top: 0.5rem; }

.reminders-header {
  margin-bottom: 0.85rem;
}

.reminders-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.reminders-subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.reminder-timing-note {
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.reminder-timing-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reminder-timing-item + .reminder-timing-item {
  margin-top: 0.35rem;
}

.reminder-timing-item--plain {
  padding-left: 3.25rem;
}

.reminder-legend-swatch {
  flex-shrink: 0;
  width: 2.75rem;
  height: 1.1rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

.reminder-legend-swatch.reminder-window-30 {
  background: var(--reminder-window-30-gradient);
  border-color: var(--reminder-window-30-border);
}

.reminder-legend-swatch.reminder-window-60 {
  background: var(--reminder-window-60-gradient);
  border-color: var(--reminder-window-60-border);
}

.reminder-legend-swatch.reminder-window-90 {
  background: var(--reminder-window-90-gradient);
  border-color: var(--reminder-window-90-border);
}

.reminders-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.reminders-empty[hidden] { display: none !important; }

/* Communication log table (dashboard 90/60/30 section) */
.reminder-agent-empty {
  color: var(--text-muted);
}

.reminder-agent-name {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.comm-log-table tbody tr.comm-log-client-row td {
  vertical-align: middle;
}

.comm-log-client-row {
  cursor: pointer;
  transition: box-shadow 0.15s var(--ease), filter 0.15s var(--ease);
}

.comm-log-client-row.reminder-window-30 td,
.comm-log-client-row.reminder-window-60 td,
.comm-log-client-row.reminder-window-90 td {
  background: transparent;
  border-bottom-color: rgba(17, 17, 17, 0.08);
}

tr.expiring-critical td,
tr.expiring-warning td,
tr.expiring-upcoming td,
tr.expiring-safe td {
  background: transparent;
}

.comm-log-client-row.reminder-window-30 .comm-log-client-name,
.comm-log-client-row.reminder-window-60 .comm-log-client-name,
.comm-log-client-row.reminder-window-90 .comm-log-client-name,
.comm-log-client-row.reminder-window-30 .comm-log-next-reminder-date,
.comm-log-client-row.reminder-window-60 .comm-log-next-reminder-date,
.comm-log-client-row.reminder-window-90 .comm-log-next-reminder-date {
  color: var(--reminder-window-text);
  font-weight: 700;
}

.comm-log-client-row.reminder-window-30 .comm-log-last-contact,
.comm-log-client-row.reminder-window-60 .comm-log-last-contact,
.comm-log-client-row.reminder-window-90 .comm-log-last-contact {
  color: rgba(17, 17, 17, 0.72);
}

.comm-log-client-row.reminder-window-30 .comm-log-chevron,
.comm-log-client-row.reminder-window-60 .comm-log-chevron,
.comm-log-client-row.reminder-window-90 .comm-log-chevron {
  color: var(--reminder-window-text);
}

.comm-log-detail-row.is-expanded td {
  padding: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface) !important;
}

.comm-log-detail-panel {
  padding: 0.85rem 1.25rem 1rem 2.25rem;
  background: var(--surface);
}

.comm-log-next-reminder-cell {
  vertical-align: middle;
}

.comm-log-next-reminder-date {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.comm-log-client-row:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--comm-teal);
}

.comm-log-client-row:not([class*='reminder-window-']):hover {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.comm-log-row--responded:hover,
.comm-log-row--contacted:hover,
.comm-log-row--no-response:hover {
  filter: brightness(0.98);
}

.comm-log-client-cell {
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comm-log-client-cell .comm-log-chevron {
  margin-right: 0.55rem;
  vertical-align: middle;
}

.comm-log-client-cell .comm-log-client-name {
  vertical-align: middle;
}

.comm-log-chevron {
  flex-shrink: 0;
  color: var(--comm-teal);
  font-size: 0.625rem;
  line-height: 1;
  display: inline-block;
  transform-origin: center center;
  transition: transform 200ms ease;
}

.comm-log-client-row.is-expanded .comm-log-chevron {
  transform: rotate(90deg);
}

.comm-log-client-name {
  min-width: 0;
  font-weight: 600;
}

.comm-log-last-contact {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.comm-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.comm-status-pill--responded {
  background: var(--comm-status-responded-bg);
  color: var(--comm-status-responded-text);
}

.comm-status-pill--contacted {
  background: var(--comm-status-contacted-bg);
  color: var(--comm-status-contacted-text);
}

.comm-status-pill--no-response {
  background: var(--comm-status-no-response-bg);
  color: var(--comm-status-no-response-text);
}

.comm-status-pill--completed {
  background: var(--comm-status-completed-bg);
  color: var(--comm-status-completed-text);
}

.comm-status-pill--need-re-written {
  background: var(--comm-status-need-re-written-bg);
  color: var(--comm-status-need-re-written-text);
}

.comm-status-pill--csr-notified {
  background: var(--comm-status-csr-notified-bg);
  color: var(--comm-status-csr-notified-text);
}

.comm-status-pill--customer-notified {
  background: var(--comm-status-customer-notified-bg);
  color: var(--comm-status-customer-notified-text);
}

.comm-method-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.42rem;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
}

.comm-method-pill--email {
  background: var(--comm-blue-bg);
  color: var(--comm-blue-text);
}

.comm-method-pill--sms {
  background: var(--comm-teal-bg);
  color: var(--comm-teal-text);
}

.comm-method-pill--phone {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.comm-last-method {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.comm-last-method--inbound {
  color: var(--comm-blue-text);
}

.comm-last-method--outbound {
  color: var(--text-secondary);
}

.comm-method-empty {
  color: var(--text-muted);
}

.comm-log-detail-row {
  display: none;
}

.comm-log-detail-row.is-expanded {
  display: table-row;
}

.comm-log-detail-row td {
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.comm-log-detail--responded:not(.is-expanded) td {
  background: var(--comm-row-responded-detail);
}

.comm-log-detail--contacted:not(.is-expanded) td {
  background: var(--comm-row-contacted-detail);
}

.comm-log-detail--no-response:not(.is-expanded) td {
  background: var(--comm-row-no-response-detail);
}

.comm-log-detail--completed:not(.is-expanded) td {
  background: var(--comm-row-completed-detail);
}

.comm-log-timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.85rem;
  border-left: 2px solid var(--border);
}

.comm-log-timeline-entry {
  position: relative;
  padding: 0 0 0.95rem 0.85rem;
}

.comm-log-timeline-entry:last-child {
  padding-bottom: 0.15rem;
}

.comm-log-timeline-entry::before {
  content: '';
  position: absolute;
  left: calc(-0.85rem - 5px);
  top: 0.35rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
}

.comm-log-timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.25rem;
}

.comm-log-timestamp {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.comm-log-direction {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.comm-log-direction-arrow {
  font-size: 0.875rem;
  line-height: 1;
}

.comm-log-direction--inbound {
  color: var(--comm-status-responded-text);
}

.comm-log-timeline-preview {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.comm-log-timeline-empty {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.35rem;
  max-width: 40rem;
}

.access-denied-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 1.35rem;
  max-width: 32rem;
}

.access-denied-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.access-denied-desc {
  margin: 0 0 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.settings-section-header {
  margin-bottom: 1.25rem;
}

.settings-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.settings-section-desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.25rem;
}

.settings-row-label {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.settings-row-hint {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.settings-theme-value {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: min(100%, 14rem);
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
}

.settings-theme-value-icon {
  display: inline-flex;
  color: var(--text-secondary);
}

.theme-picker {
  position: relative;
  min-width: min(100%, 14rem);
}

.theme-picker-trigger {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.theme-picker-trigger:hover {
  border-color: var(--focus-border);
  background: var(--bg-subtle);
}

.theme-picker-trigger:focus-visible {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.theme-picker-icon {
  display: inline-flex;
  color: var(--text-secondary);
}

.theme-picker-label {
  flex: 1;
  text-align: left;
}

.theme-picker-chevron {
  display: inline-flex;
  color: var(--text-muted);
}

.theme-picker-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.35rem);
  right: 0;
  left: 0;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--menu-bg);
  border: 1px solid var(--menu-border);
  border-radius: var(--radius-btn);
  box-shadow: var(--menu-shadow);
}

.theme-picker-menu[hidden] {
  display: none !important;
}

.theme-picker-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.theme-picker-option:hover,
.theme-picker-option:focus-visible {
  background: var(--bg-subtle);
  outline: none;
}

.theme-picker-option.is-selected {
  background: var(--bg-subtle);
  font-weight: 600;
}

.theme-picker-option-icon {
  display: inline-flex;
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .ap-sidebar {
    width: 14rem;
    padding: 1rem 0.65rem;
  }

  .ap-topbar,
  .ap-content {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

@media (max-width: 720px) {
  .ap-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-right { align-items: flex-start; }
  .job-note { max-width: none; text-align: left; }
  .my-action-form-inline { grid-template-columns: 1fr; }
  .my-action-form-actions { justify-content: flex-start; }
}
