/* ========== CORE LEXES GLOBAL TYPOGRAPHY RULE (NON-NEGOTIABLE) ========== */
/* Every font must be Times New Roman at 12pt (~16px). Proper desktop scale. Do not change unless superuser instructs. */
html, body, html *, body *, *, *::before, *::after, .modal, .modal *, .dropdown-menu, .dropdown-menu *, .form-control, .form-select, .btn, .alert, .tooltip, .popover { font-family: "Times New Roman", Times, serif !important; font-size: 12pt !important; }

* {
  box-sizing: border-box;
}

:root {
  /* Sidebar: only as wide as longest nav label + icon + comfort pad */
  --clx-sidebar-width: 158px;
  --clx-sidebar-link-pad-x: 6px;
  --clx-sidebar-link-pad-y: 3px;
  --clx-sidebar-logo-max: 88px;
  font-size: 100%;
  color-scheme: light;
  /* Core Lexes theme: sidebar + section banners share one chrome blue */
  --primary-banner-bg: #373B41;
  --primary-banner-hover: #8C5E3C;
  --primary-banner-active: #8C5E3C;
  --chrome-sidebar-bg: #373B41;
  --brand-earth-deep: #373B41;
  --brand-earth: #8C5E3C;
  --brand-earth-dark: #6E4A30;
  --brand-accent: #8C5E3C;
  --brand-warm: #f59e0b;
  --text-primary: #0f172a;
  --text-muted: #64748b;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --border: #cbd5e1;
  --shadow-soft: 0 18px 36px rgba(15, 23, 42, 0.12);
  --shadow-card: 0 14px 28px rgba(15, 23, 42, 0.08);
  --glow: 0 0 18px rgba(140, 94, 60, 0.35);
}

body.app-body {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
  background:
    radial-gradient(ellipse 140% 70% at 50% -8%, rgba(240, 236, 235, 0.55) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, #F0ECEB 0%, #f8fafc 42%, #ffffff 100%) !important;
  color: var(--text-primary);
  margin: 0;
  overflow-x: hidden;
}

/*
 * Staff shell Phase 1: short pages fill the browser viewport; long pages grow.
 * Page-specific internal scroll is unchanged.
 */
html:has(.app-page-wrapper),
body.app-body:has(.app-page-wrapper) {
  min-height: 100vh; /* fallback */
  min-height: 100dvh;
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ========== GLOBAL FOOTER: Single copyright at bottom center. No right panel, no duplicates. ========== */
body {
  overflow-x: hidden;
}
/* Footer: always bottom center, never fixed/sticky/absolute, never on right */
.global-site-footer,
.global-site-footer.app-footer,
.global-site-footer.auth-footer {
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  float: none !important;
  width: 100% !important;
  text-align: center !important;
  transform: none !important;
  padding: 14px 28px 22px !important;
  font-size: 12pt !important;
  color: var(--text-muted) !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}
.global-site-footer.app-footer {
  margin-top: auto !important;
}
/* Staff shell: footer sits in the content column under .app-main (not below the sidebar). */
.app-page-wrapper > .global-site-footer.app-footer {
  margin-top: 0 !important;
  padding: 4px 16px 6px !important;
}
.global-site-footer.auth-footer {
  margin-top: auto !important;
  padding: 14px 28px 22px !important;
}
/* Never show footer/copyright inside header - only at bottom */
.app-header footer,
.app-header .global-site-footer {
  display: none !important;
}
/* Hide footers/copyright panels that are wrongly positioned (inline styles only) */
footer[style*="position: fixed"],
footer[style*="position:fixed"],
footer[style*="position: sticky"],
footer[style*="position: absolute"][style*="right"],
footer[style*="writing-mode"] {
  display: none !important;
}
aside:not(.app-sidebar)[style*="position: fixed"],
aside:not(.app-sidebar)[style*="position:fixed"],
aside:not(.app-sidebar)[style*="right: 0"],
div[style*="right: 0"][style*="position: fixed"],
div[style*="right: 0"][style*="position:fixed"],
[style*="writing-mode: vertical"],
[style*="writing-mode:vertical"] {
  display: none !important;
}

/*
 * Page wrapper Phase 1: fill available browser height (min 100dvh).
 * Row 1 = sidebar + main (expands into remaining space). Row 2 = compact footer.
 * Long pages grow beyond the viewport; no fixed max-height.
 * Sidebar stays in the content row only (see clx-chrome-modern.css).
 * Operating Entity internal-scroll exception remains in clx-uc-admin-signature.css.
 */
.app-page-wrapper {
  display: grid;
  grid-template-columns: var(--clx-sidebar-width, 158px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 100vh; /* fallback */
  min-height: 100dvh;
  height: auto;
  max-height: none;
  overflow: visible;
  width: 100%;
  box-sizing: border-box;
  align-content: stretch;
  align-items: stretch;
}
.app-page-wrapper:has(> .clx-impersonation-banner) {
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.app-page-wrapper > .clx-impersonation-banner {
  grid-column: 1 / -1;
  grid-row: 1;
}
.app-page-wrapper > .global-site-footer {
  grid-column: 2;
  grid-row: 2;
  flex-shrink: 0;
  margin-top: 0 !important;
  align-self: end;
}
.app-page-wrapper:has(> .clx-impersonation-banner) > .global-site-footer {
  grid-row: 3;
}
/* Layout: two columns only (sidebar + main). No right panel. */
.app-shell {
  display: contents;
  background: transparent !important;
}

/* Legal sidebar width, padding, height and scrolling: clx-chrome-modern.css. */
.app-sidebar {
  color: #f2f2f2;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 12px rgba(15, 23, 42, 0.28);
}

.sidebar-brand {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 0;
  flex-shrink: 0;
}

.app-sidebar .brand-logo {
  width: auto;
  height: auto;
  max-width: var(--clx-sidebar-logo-max, 88px);
  display: block;
  object-fit: contain;
  /* Blend into sidebar navy: no border/shadow/rounded “card” edge; nudge image blues toward panel #0f172a */
  border: none;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  filter: brightness(0.91) saturate(0.86) contrast(1.04);
}

/* Nav link layout/colors only — menu label font-size is sole authority in clx-chrome-modern.css */
.app-sidebar .sidebar-nav-flat .nav-link {
  color: #f2f2f2;
  border-radius: 6px;
  padding: var(--clx-sidebar-link-pad-y, 3px) var(--clx-sidebar-link-pad-x, 6px);
  margin-bottom: 0;
  font-weight: 400 !important;
  font-style: normal !important;
  text-transform: none;
  letter-spacing: normal;
}

.app-sidebar .sidebar-nav-flat .nav-link:hover,
.app-sidebar .sidebar-nav-flat .nav-link:focus {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.app-sidebar .sidebar-nav-flat .nav-link.active {
  background: #c9a227;
  color: #0f172a;
  font-weight: 700 !important;
  font-style: normal !important;
  box-shadow: none;
}

.app-sidebar .sidebar-nav-flat .nav-link.active::before {
  display: none;
}

.app-sidebar .nav-link {
  color: #f2f2f2;
  border-radius: 6px;
  padding: var(--clx-sidebar-link-pad-y, 3px) var(--clx-sidebar-link-pad-x, 6px);
  font-weight: 500;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link:focus {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.app-sidebar .nav-link.active {
  background: #c9a227;
  color: #0f172a;
  font-weight: 700;
  box-shadow: none;
}

.app-sidebar .nav-link.active::before {
  display: none;
}

.app-sidebar .nav-ico {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-right: 5px;
}

.app-main {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  height: auto;
  max-height: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-x: hidden;
  overflow-y: visible;
  background: transparent !important;
}
.app-page-wrapper:has(> .clx-impersonation-banner) .app-main {
  grid-row: 2;
}

.app-header {
  background: var(--chrome-sidebar-bg, #0f172a) !important;
  border-bottom: 1px solid rgba(201, 162, 39, 0.35);
  padding: var(--clx-header-pad-y, 8px) var(--clx-header-pad-x, 16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(15, 31, 58, 0.18);
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 0 1 auto;
  max-width: min(42vw, 34rem);
}

.header-label {
  font-weight: 600;
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
  color: #ffffff;
  letter-spacing: normal;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.header-subtitle {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
  color: rgba(255, 255, 255, 0.75);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-search {
  width: min(280px, 32vw);
}

/* Hard lock: bare SVG in header search must never inflate the sticky app-header
   (creates hundreds of px of empty navy above matter content). Chrome CSS also
   sizes this; app.css is the fail-safe if chrome rules fail to load. */
.app-header .app-search,
.app-header .app-search-wrap,
.app-header #clx-header-search-form {
  max-height: 3rem;
  min-height: 0;
  overflow: visible;
}
.app-header .app-search-ico {
  display: block;
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  flex-shrink: 0;
  overflow: hidden;
}
.app-header .app-search-ico svg {
  display: block;
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
}

.app-search .form-control {
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 39, 0.45);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding-left: 12px;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  min-height: 1.75rem;
}

.app-search .form-control::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.app-search .form-control:focus {
  background: rgba(255, 255, 255, 0.16);
  border-color: #c9a227;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.45);
  outline: none;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
  color: #fff;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #c9a227;
  color: #0f172a;
  font-weight: 700;
}

/* Profile dropdown toggle uses color:#fff !important; initial must stay readable on gold circle */
.app-header .header-actions .user-avatar {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  background: #c9a227 !important;
}

.app-header .header-actions .user-name {
  color: #fff !important;
  font-size: 11pt !important;
}

.app-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: var(--clx-page-pad-y, 12px) var(--clx-page-pad-x, 16px);
  display: flex;
  flex-direction: column;
  gap: var(--clx-page-gap, 12px);
  background: transparent !important;
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
}

.app-content .form-control,
.app-content .form-select,
.app-content .btn,
.app-content .table,
.app-content .list-group-item {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
}

.app-footer {
  padding: 14px 28px 22px;
  font-size: 12pt !important;
  color: var(--text-muted);
  text-align: center;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
  font-weight: 700;
  color: var(--brand-earth-deep);
}

.page-subtitle {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
  color: var(--text-muted);
}

/* Matter type label under matter number: prominent, black, bold, all matter types (Family Law, SSDI/SSI, etc.) */
.matter-type-label {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 14pt !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  line-height: 1.3;
}

/* Clean spacing between matter number and matter type when matter-type-label is present */
.page-subtitle:has(.matter-type-label) {
  margin-top: 0.2em;
  margin-bottom: 0;
}

.page-actions {
  display: flex;
  gap: 10px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}
/* Matters Results: transform off (card:hover) + overflow hidden for internal row scroll. Height via --ml-results-h in clx-matters.css. */
#ml-results-card{transform:none !important;transition:none !important;overflow:hidden !important;}
#ml-results-card:hover{transform:none !important;box-shadow:var(--shadow-card) !important;}

/* Core Lexes: section banners — same blue as sidebar; thin band (matches matter subtab banner density) */
.card-header,
.clx-card-header,
.card .card-header,
.clx-card .clx-card-header,
.collapsible-box .card-header,
.billing-card-header,
.dashboard-box .card-header,
.clx-card.dashboard-box .clx-card-header {
  background: var(--chrome-sidebar-bg, #0f172a) !important;
  background-color: var(--chrome-sidebar-bg, #0f172a) !important;
  border-bottom: none !important;
  border-radius: 16px 16px 0 0;
  font-weight: 600;
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
  color: #ffffff !important;
  padding: 4px 8px;
  min-height: 24px;
  line-height: 1.1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Workspace + Matters list: square top corners on chrome section headers (project lock) */
.workspace-dashboard .card > .card-header,
#ml-filters-hdr,
#ml-results-hdr {
  border-radius: 0 !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

.card-header .text-muted {
  color: rgba(255, 255, 255, 0.85) !important;
  width: 100%;
  font-size: 12pt !important;
  font-weight: 400;
  margin-top: 2px;
}

.card-header .badge-soft {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Financial (USD) + Work in Progress: prior black banners + original banner metrics per immutable financial/WIP UI locks */
#financial-box > .card-header.clx-card-header,
#financial-box #global-financial-header,
#billing-pane-filters > .card-header.clx-card-header {
  background: #000000 !important;
  background-color: #000000 !important;
  padding: 12px 16px !important;
  min-height: 48px !important;
  line-height: inherit;
}

.table {
  margin-bottom: 0;
}

.table th {
  font-size: 12pt !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.table tbody tr:hover {
  background: #eef4ff;
}

/* Personal Injury sub-subtabs: white column labels on Bootstrap table-dark headers (readability lock) */
#pi-pane .table thead.table-dark th,
#pi-pane thead.table-dark th {
  color: #ffffff !important;
}

.badge-soft {
  background: #e5e5e5;
  color: #3f3f3f;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12pt !important;
}

.status-pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12pt !important;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e5e5e5;
  color: #3f3f3f;
}

.status-open {
  background: #e7e7e7;
  color: #2a2a2a;
}

.status-active,
.status-in-progress {
  background: #e3e3e3;
  color: #3a3a3a;
}

.status-pending {
  background: #ededed;
  color: #4a4a4a;
}

.status-closed {
  background: #e4e4e4;
  color: #5a5a5a;
}

.status-cancelled,
.status-canceled {
  background: #e2e2e2;
  color: #5a5a5a;
}

.status-on-hold,
.status-on-hold-,
.status-on-hold-1 {
  background: #e6e6e6;
  color: #4a4a4a;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  position: relative;
  background-image:
    linear-gradient(135deg, rgba(15, 23, 42, 0.82) 0%, rgba(30, 58, 138, 0.55) 40%, rgba(248, 250, 252, 0.75) 100%),
    url("/static/img/core-lexes-signin.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.auth-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 28px;
  width: min(360px, 100%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.auth-brand {
  font-weight: 700;
  font-size: 12pt !important;
  color: var(--brand-earth-deep);
  margin-bottom: 16px;
}

.auth-form {
  max-width: 320px;
  margin: 0 auto;
}

.auth-footer {
  margin-top: auto;
  padding: 14px 28px 22px;
  font-size: 12pt !important;
  color: var(--text-muted);
  text-align: center;
  width: 100%;
}

.text-muted {
  color: var(--text-muted) !important;
}

.list-group-item {
  border-color: var(--border);
}

.list-group-item:hover {
  background: #f3f3f3;
}

.link-muted {
  color: var(--text-muted);
  text-decoration: none;
}

.link-muted:hover {
  color: #5a5a54;
}

/* ========== CORE LEXES: primary buttons — blue chrome, white text (site-wide) ========== */
.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger,
.btn-dark,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-info,
.btn-outline-warning,
.btn-outline-danger,
.btn-outline-dark,
.btn-light {
  background: var(--primary-banner-bg, #0f172a) !important;
  border-color: var(--primary-banner-bg, #0f172a) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.btn:hover,
.btn:focus,
.btn-primary:hover,
.btn-primary:focus,
.btn-secondary:hover,
.btn-secondary:focus,
.btn-success:hover,
.btn-success:focus,
.btn-info:hover,
.btn-info:focus,
.btn-warning:hover,
.btn-warning:focus,
.btn-danger:hover,
.btn-danger:focus,
.btn-dark:hover,
.btn-dark:focus,
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-success:hover,
.btn-outline-success:focus,
.btn-outline-info:hover,
.btn-outline-info:focus,
.btn-outline-warning:hover,
.btn-outline-warning:focus,
.btn-outline-danger:hover,
.btn-outline-danger:focus,
.btn-outline-dark:hover,
.btn-outline-dark:focus,
.btn-light:hover,
.btn-light:focus {
  background: var(--primary-banner-hover, #2563eb) !important;
  border-color: var(--primary-banner-hover, #2563eb) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

.btn-black {
  background: var(--primary-banner-bg, #0f172a) !important;
  border-color: var(--primary-banner-bg, #0f172a) !important;
  color: #ffffff !important;
}

.btn-black:hover,
.btn-black:focus {
  background: var(--primary-banner-hover, #2563eb) !important;
  border-color: var(--primary-banner-hover, #2563eb) !important;
  color: #ffffff !important;
}

.btn-primary {
  background: var(--primary-banner-bg, #0f172a) !important;
  border-color: var(--primary-banner-bg, #0f172a) !important;
  color: #ffffff !important;
}

.btn-primary:hover {
  background: var(--primary-banner-hover, #2563eb) !important;
  border-color: var(--primary-banner-hover, #2563eb) !important;
  color: #ffffff !important;
}

.btn-outline-primary {
  background: var(--primary-banner-bg, #0f172a) !important;
  border-color: var(--primary-banner-bg, #0f172a) !important;
  color: #ffffff !important;
}

.btn-outline-primary:hover {
  background: var(--primary-banner-hover, #2563eb) !important;
  border-color: var(--primary-banner-hover, #2563eb) !important;
  color: #ffffff !important;
}

/* Global pill-style subtabs (Summary, Billing, Tasks, etc.) – match Bills page */
.subtab-pills,
.app-content .nav-pills,
.card .nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--clx-subtab-gap, 6px);
  margin-bottom: 0;
}

.subtab-pills .nav-link,
.app-content .nav-pills .nav-link,
.card .nav-pills .nav-link {
  border-radius: var(--clx-btn-radius, 6px);
  padding: var(--clx-subtab-pad-y, 4px) var(--clx-subtab-pad-x, 10px);
  font-size: 12pt !important;
  font-weight: 600;
  color: var(--clx-text-navy, #1e293b) !important;
  background: #ffffff !important;
  border: 1px solid #d0d0d0 !important;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.subtab-pills .nav-link:hover,
.app-content .nav-pills .nav-link:hover,
.card .nav-pills .nav-link:hover {
  background: #e8edf4 !important;
  border-color: var(--brand-earth) !important;
  color: var(--brand-earth) !important;
}

.subtab-pills .nav-link.active,
.app-content .nav-pills .nav-link.active,
.card .nav-pills .nav-link.active {
  background: var(--primary-banner-bg, #0f172a) !important;
  color: #ffffff !important;
  border-color: var(--primary-banner-bg, #0f172a) !important;
  box-shadow: 0 2px 8px rgba(20, 43, 82, 0.35);
}

.billing-toolbar .card-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
}

.billing-tabs-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin-bottom: 18px;
}

.billing-tabs-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
}

.billing-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 12pt !important;
  font-weight: 600;
  color: var(--brand-earth);
  background: linear-gradient(135deg, #edf4ff 0%, #ffffff 100%);
  border: 1px solid var(--border);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.billing-tabs-inline .billing-tab {
  color: var(--brand-earth) !important;
  background: linear-gradient(135deg, #edf4ff 0%, #ffffff 100%) !important;
  border: 1px solid var(--border) !important;
  text-decoration: none !important;
}

.billing-tab.active,
.billing-tabs-inline .billing-tab.active {
  background: linear-gradient(135deg, var(--brand-earth) 0%, #1f4b87 100%);
  color: #ffffff !important;
  border-color: var(--brand-earth) !important;
  box-shadow: var(--glow);
}

.billing-tab:hover,
.billing-tabs-inline .billing-tab:hover {
  border-color: var(--brand-earth);
  transform: translateY(-1px);
}

.billing-tabs .nav-link.active {
  background: var(--brand-earth);
  color: #ffffff;
}

/* Bills subtab: status boxes (Drafted Pending Invoices, Unpaid, Paid) */
.bills-status-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bills-status-btn {
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 12pt !important;
  font-weight: 600;
  color: #1f1f1f;
  background: #ffffff;
  border: 1px solid var(--border);
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.bills-status-btn:hover {
  background: #e8edf4;
  border-color: var(--brand-earth);
  color: var(--brand-earth);
}
.bills-status-btn.active {
  background: var(--primary-banner-bg, #0f172a) !important;
  color: #ffffff;
  border-color: var(--primary-banner-bg, #0f172a);
  box-shadow: 0 2px 8px rgba(20, 43, 82, 0.35);
}
.bills-search-wrap {
  flex-shrink: 0;
}

.billing-filters {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.billing-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.billing-summary--spaced {
  display: grid;
  margin-top: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.billing-summary--transactions {
  align-items: stretch;
}

.summary-item {
  background: #f7f7f7;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.billing-actions {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #f9f9f9;
}

.billing-actions .form-check {
  margin-top: 6px;
}

.billing-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.empty-state {
  padding: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
}

.empty-state--spaced {
  margin-top: 18px;
}

.empty-state--separated {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.stat-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid #e0e7f5;
  background: linear-gradient(135deg, #ffffff 0%, #f7faff 100%);
}

.stat-label {
  font-size: 12pt !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 12pt !important;
  font-weight: 700;
  color: var(--brand-earth-deep);
}

a.stat-value {
  color: var(--brand-earth-deep);
}
a.stat-value:hover {
  color: var(--brand-earth);
  text-decoration: underline;
}

.calendar-day {
  min-width: 160px;
  background: #ffffff;
}

.calendar-grid {
  border-color: var(--border);
}

.calendar-grid th,
.calendar-grid td {
  border: 1px solid var(--border);
}

.calendar-grid td {
  min-height: 140px;
  height: 140px;
  vertical-align: top;
  padding: 8px;
}

.calendar-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.calendar-day-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.calendar-entry {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 8px;
  background: #f7f7f7;
}

.calendar-entry-title {
  font-size: 12pt !important;
  font-weight: 600;
  color: var(--text-primary);
}

.calendar-entry-meta {
  font-size: 12pt !important;
  color: var(--text-muted);
}

.calendar-entry-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.calendar-header-month-year {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 14pt !important;
  font-weight: bold !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ========== Calendar expanded event type colors (distinct, at-a-glance) ========== */
.calendar-entry.calendar-event-type-COURT_EVENT,
.calendar-entry.calendar-event-type-COURT_HEARING,
.calendar-entry.calendar-event-type-TRIAL,
.calendar-entry.calendar-event-type-DEPOSITION,
.calendar-entry.calendar-event-type-DEADLINE,
.calendar-entry.calendar-event-type-CLIENT_MEETING,
.calendar-entry.calendar-event-type-CALL,
.calendar-entry.calendar-event-type-INTERNAL_MEETING,
.calendar-entry.calendar-event-type-MEETING,
.calendar-entry.calendar-event-type-TASK,
.calendar-entry.calendar-event-type-BILLING_REMINDER,
.calendar-entry.calendar-event-type-MEDIATION,
.calendar-entry.calendar-event-type-ARBITRATION,
.calendar-entry.calendar-event-type-SETTLEMENT_CONFERENCE,
.calendar-entry.calendar-event-type-MEDICAL_APPOINTMENT,
.calendar-entry.calendar-event-type-EXPERT_CONSULTATION,
.calendar-entry.calendar-event-type-DISCOVERY_CUTOFF,
.calendar-entry.calendar-event-type-FILING_DEADLINE,
.calendar-entry.calendar-event-type-SERVICE_DEADLINE,
.calendar-entry.calendar-event-type-MARKETING_NETWORKING,
.calendar-entry.calendar-event-type-PERSONAL,
.calendar-entry.calendar-event-type-OTHER,
.list-group-item.calendar-event-type-COURT_EVENT,
.list-group-item.calendar-event-type-COURT_HEARING,
.list-group-item.calendar-event-type-TRIAL,
.list-group-item.calendar-event-type-DEPOSITION,
.list-group-item.calendar-event-type-DEADLINE,
.list-group-item.calendar-event-type-CLIENT_MEETING,
.list-group-item.calendar-event-type-CALL,
.list-group-item.calendar-event-type-INTERNAL_MEETING,
.list-group-item.calendar-event-type-MEETING,
.list-group-item.calendar-event-type-TASK,
.list-group-item.calendar-event-type-BILLING_REMINDER,
.list-group-item.calendar-event-type-MEDIATION,
.list-group-item.calendar-event-type-ARBITRATION,
.list-group-item.calendar-event-type-SETTLEMENT_CONFERENCE,
.list-group-item.calendar-event-type-MEDICAL_APPOINTMENT,
.list-group-item.calendar-event-type-EXPERT_CONSULTATION,
.list-group-item.calendar-event-type-DISCOVERY_CUTOFF,
.list-group-item.calendar-event-type-FILING_DEADLINE,
.list-group-item.calendar-event-type-SERVICE_DEADLINE,
.list-group-item.calendar-event-type-MARKETING_NETWORKING,
.list-group-item.calendar-event-type-PERSONAL,
.list-group-item.calendar-event-type-OTHER {
  border-left-width: 4px;
  border-left-style: solid;
}
.calendar-entry.calendar-event-type-COURT_EVENT,
.list-group-item.calendar-event-type-COURT_EVENT { border-left-color: #DC143C; }
.calendar-entry.calendar-event-type-DEPOSITION,
.list-group-item.calendar-event-type-DEPOSITION { border-left-color: #CC5500; }
.calendar-entry.calendar-event-type-DEADLINE,
.list-group-item.calendar-event-type-DEADLINE { border-left-color: #800020; }
.calendar-entry.calendar-event-type-CLIENT_MEETING,
.list-group-item.calendar-event-type-CLIENT_MEETING { border-left-color: #4169E1; }
.calendar-entry.calendar-event-type-CALL,
.list-group-item.calendar-event-type-CALL { border-left-color: #00CED1; }
.calendar-entry.calendar-event-type-INTERNAL_MEETING,
.list-group-item.calendar-event-type-INTERNAL_MEETING { border-left-color: #708090; }
.calendar-entry.calendar-event-type-MEETING,
.list-group-item.calendar-event-type-MEETING { border-left-color: #4169E1; }
.calendar-entry.calendar-event-type-TASK,
.list-group-item.calendar-event-type-TASK { border-left-color: #EE82EE; }
.calendar-entry.calendar-event-type-BILLING_REMINDER,
.list-group-item.calendar-event-type-BILLING_REMINDER { border-left-color: #50C878; }
.calendar-entry.calendar-event-type-MEDIATION,
.list-group-item.calendar-event-type-MEDIATION { border-left-color: #FFD700; }
.calendar-entry.calendar-event-type-ARBITRATION,
.list-group-item.calendar-event-type-ARBITRATION { border-left-color: #4B0082; }
.calendar-entry.calendar-event-type-COURT_HEARING,
.list-group-item.calendar-event-type-COURT_HEARING { border-left-color: #FF2400; }
.calendar-entry.calendar-event-type-TRIAL,
.list-group-item.calendar-event-type-TRIAL { border-left-color: #002060; }
.calendar-entry.calendar-event-type-SETTLEMENT_CONFERENCE,
.list-group-item.calendar-event-type-SETTLEMENT_CONFERENCE { border-left-color: #B87333; }
.calendar-entry.calendar-event-type-MEDICAL_APPOINTMENT,
.list-group-item.calendar-event-type-MEDICAL_APPOINTMENT { border-left-color: #40E0D0; }
.calendar-entry.calendar-event-type-EXPERT_CONSULTATION,
.list-group-item.calendar-event-type-EXPERT_CONSULTATION { border-left-color: #FFBF00; }
.calendar-entry.calendar-event-type-DISCOVERY_CUTOFF,
.list-group-item.calendar-event-type-DISCOVERY_CUTOFF { border-left-color: #FF00FF; }
.calendar-entry.calendar-event-type-FILING_DEADLINE,
.list-group-item.calendar-event-type-FILING_DEADLINE { border-left-color: #0047AB; }
.calendar-entry.calendar-event-type-SERVICE_DEADLINE,
.list-group-item.calendar-event-type-SERVICE_DEADLINE { border-left-color: #CB4154; }
.calendar-entry.calendar-event-type-MARKETING_NETWORKING,
.list-group-item.calendar-event-type-MARKETING_NETWORKING { border-left-color: #FF7F50; }
.calendar-entry.calendar-event-type-PERSONAL,
.list-group-item.calendar-event-type-PERSONAL { border-left-color: #36454F; }
.calendar-entry.calendar-event-type-OTHER,
.list-group-item.calendar-event-type-OTHER { border-left-color: #6c757d; }

/* Global collapsible boxes: minimize/maximize for every card/panel (Core Lexes rule) */
.collapsible-box .card-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: wrap;
  gap: 0.5rem;
  cursor: pointer;
}

.collapsible-box .collapsible-box-header-label {
  flex: 1;
  min-width: 0;
}

.collapsible-box-toggle {
  flex-shrink: 0;
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  padding: 0.2rem 0.35rem !important;
  border-radius: 0;
  cursor: pointer;
  font-size: 12pt !important;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
}

.collapsible-box-toggle:hover,
.collapsible-box-toggle:focus,
.collapsible-box-toggle:active {
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

.collapsible-box-icon {
  display: inline-block;
  transition: transform 0.15s ease;
}

.collapsible-box.collapsed .collapsible-box-icon {
  transform: rotate(-90deg);
}

/* Hide entire box content when collapsed (tables, forms, charts, all content) */
.collapsible-box.collapsed .collapsible-box-body {
  display: none !important;
}

.collapsible-box.collapsed .card-footer {
  display: none !important;
}

.collapsible-box.collapsed > *:not(.card-header) {
  display: none !important;
}

/* Dropdowns inside collapse: prevent overflow clipping that causes immediate close */
.collapse.show {
  overflow: visible !important;
}

/* Contacts index: name as primary link (Core Lexes style, not bright external) */
.contact-name-link {
  color: var(--brand-earth, #1c3d6f);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.contact-name-link:hover {
  color: var(--brand-earth-dark, #142b52);
  border-bottom-color: var(--brand-earth-dark, #142b52);
}

/* ========== Core Lexes cards (.clx-card) ========== */
.clx-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.clx-card-header .clx-card-title {
  flex: 1;
  min-width: 0;
}

/* Header action links (e.g. +ADD) stay white on black banners — except gold pencil edit controls. */
.card-header .btn-link:not(.summary-details-banner-edit):not(.clx-fc-header-edit),
.card-header .btn-link:not(.summary-details-banner-edit):not(.clx-fc-header-edit) *:not(.summary-details-banner-edit-icon),
.clx-card-header .btn-link:not(.summary-details-banner-edit):not(.clx-fc-header-edit),
.clx-card-header .btn-link:not(.summary-details-banner-edit):not(.clx-fc-header-edit) *:not(.summary-details-banner-edit-icon) {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  text-decoration: none !important;
}

.dashboard-box .card-header,
.clx-card.dashboard-box .clx-card-header {
  background: var(--primary-banner-bg, #0f172a) !important;
  color: #ffffff !important;
}

/* ========== Matter Tasks: blue banner and urgent indicators ========== */
.matter-tasks-banner {
  background: var(--primary-banner-bg, #0f172a) !important;
  color: #ffffff !important;
  border-bottom: 1px solid var(--primary-banner-bg, #0f172a);
}

#matterTaskDetailModal {
  z-index: 1060;
}

#matterTaskDetailModal .modal-dialog,
#matterTaskDetailModal .modal-content {
  pointer-events: auto;
}

#matterTaskDetailModal .modal-body {
  max-height: min(70vh, 34rem);
  overflow-y: auto;
}

/* Modal is moved to document.body; freeze nearby cards so .card:hover transform cannot repaint beneath it */
body.modal-open .matter-tasks-box,
body.modal-open .clx-tk-card,
body.modal-open #financial-box.card,
body.modal-open #billing-wip-section.card,
body.modal-open #billing-legacy-ledger.card,
body.modal-open #matter-tabs-card.card,
body.modal-open #summary-pane .card,
body.modal-open #summary-pane .clx-card.card {
  transform: none !important;
  transition: none !important;
}

#matterTaskDetailBody .matter-task-detail-row {
  margin-bottom: 0.25rem;
}

#matterTaskDetailBody .matter-task-detail-text {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0;
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
  line-height: 1.35;
}

.task-urgent-badge-matter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #c00;
  font-weight: bold;
  font-size: 0.95rem;
  margin-right: 0.25rem;
  min-width: 1.2em;
}

.task-row-urgent-matter {
  background-color: rgba(204, 0, 0, 0.06);
}

.task-urgent-indicator-workspace {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  width: 28px;
  height: 28px;
  margin-right: 0.5rem;
  flex-shrink: 0;
  font-size: 1.5rem;
  font-weight: bold;
  color: #c00;
  background-color: rgba(204, 0, 0, 0.12);
  border-radius: 4px;
}

.task-row-urgent-workspace {
  border-left: 4px solid #c00;
  background-color: rgba(204, 0, 0, 0.06);
}

.task-row-urgent-workspace:hover {
  background-color: rgba(204, 0, 0, 0.1);
}

/* ========== Matter Tasks subtab UI ==========
   Layout/filters/table/panels: static/css/clx-matter-tasks.css
   (obsolete tall Assign-a-Task / Tasks Assigned / Tasks Completed card CSS removed) */

#tasks-pane {
  overflow: visible !important;
}

/* ========== Task Done: large green checkmark (Task Assignments of the Day) ========== */
.task-done-checkmark {
  display: inline-block;
  font-size: 1.4em;
  font-weight: bold;
  color: #0d7d0d;
  line-height: 1;
  vertical-align: middle;
}

/* ========== Documents subtab: drag-and-drop upload ========== */
#documents-pane {
  position: relative;
}

.documents-drop-zone {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 61, 111, 0.92);
  border: 3px dashed var(--border, #d0d0d0);
  border-radius: 8px;
  pointer-events: none;
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
}

.documents-drop-zone-label {
  color: #fff;
  font-weight: 600;
}

.documents-upload-progress {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
}

.documents-upload-row .documents-upload-name {
  margin-right: 0.5rem;
}

.documents-folder-row.documents-drop-highlight,
.documents-drop-root.documents-drop-highlight {
  background-color: rgba(53, 192, 255, 0.2) !important;
  outline: 2px solid var(--brand-accent, #35c0ff);
  outline-offset: -2px;
}

.documents-doc-row[draggable="true"] {
  cursor: move;
}

.documents-folder-row {
  cursor: pointer;
}

/* Persistent drag-and-drop upload zone */
.documents-dnd-zone {
  border: 2px dashed #b0c4de;
  border-radius: 8px;
  padding: 1.25rem 1rem;
  text-align: center;
  background: #f8fafd;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
  position: relative;
}

.documents-dnd-zone:hover {
  border-color: #6aa3d5;
  background: #eef4fb;
}

.documents-dnd-zone.dnd-active {
  border-color: #1c3d6f;
  background: rgba(28, 61, 111, 0.08);
  box-shadow: 0 0 0 3px rgba(28, 61, 111, 0.15);
}

.documents-dnd-zone-icon {
  font-size: 24pt;
  display: block;
  margin-bottom: 0.3rem;
  color: #6aa3d5;
  pointer-events: none;
}

.documents-dnd-zone-text {
  color: #555;
  pointer-events: none;
}

.documents-dnd-zone-text strong {
  color: #1c3d6f;
}

.documents-dnd-zone-buttons {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Per-file progress bars */
.documents-upload-file-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
}

.documents-upload-file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.documents-upload-file-bar {
  width: 120px;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.documents-upload-file-bar-inner {
  height: 100%;
  background: #1c3d6f;
  border-radius: 3px;
  transition: width 0.15s;
  width: 0%;
}

.documents-upload-file-status {
  width: 70px;
  text-align: right;
  flex-shrink: 0;
  font-weight: 600;
}

/* ========== Documents folder pop-out panel ========== */
.documents-folder-popout {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  display: none; /* closed by default — never cover the matter shell until opened */
  align-items: stretch;
  justify-content: flex-end;
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
}
.documents-folder-popout.is-open,
.documents-folder-popout[aria-hidden="false"] {
  display: flex;
}
.documents-folder-popout[aria-hidden="true"] {
  display: none !important;
}

.documents-folder-popout-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.documents-folder-popout-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--surface, #fff);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.documents-folder-popout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--brand-earth, #1c3d6f);
  color: #fff;
  flex-shrink: 0;
}

.documents-folder-popout-title {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
  color: #fff;
  font-weight: 600;
}

.documents-folder-popout-close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0 0.25rem;
  cursor: pointer;
  opacity: 0.9;
}

.documents-folder-popout-close:hover {
  opacity: 1;
}

.documents-folder-popout-body {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}

.documents-folder-popout-dropzone {
  border: 2px dashed var(--border, #d0d0d0);
  border-radius: 6px;
  padding: 1rem;
  text-align: center;
  background: var(--surface-muted, #f5f7fb);
  transition: background 0.15s, border-color 0.15s;
}

.documents-folder-popout-dropzone-label {
  color: var(--text-muted, #707070);
}

.documents-folder-popout-dropzone.documents-folder-popout-dropzone-active {
  background: rgba(53, 192, 255, 0.12);
  border-color: var(--brand-accent, #35c0ff);
}

.documents-folder-popout-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.documents-folder-popout-list .list-group-item a {
  color: var(--brand-earth, #1c3d6f);
  text-decoration: none;
}

.documents-folder-popout-list .list-group-item a:hover {
  text-decoration: underline;
}

.documents-folder-popout-back-link {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
}
.documents-folder-popout-back-link-a {
  color: var(--brand-earth, #1c3d6f);
  text-decoration: none;
}
.documents-folder-popout-back-link-a:hover {
  text-decoration: underline;
}

/* ========== Integrations module: logo icon display ========== */
.integration-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.integration-icon img,
.integration-icon svg {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}
.integration-icon-fallback {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-muted, #f5f7fb);
  border-radius: 6px;
  font-size: 20px;
  color: var(--text-muted, #707070);
}
.integration-icon.integration-icon-lg {
  width: 80px;
  height: 80px;
}
.integration-icon.integration-icon-lg .integration-icon-fallback {
  width: 80px;
  height: 80px;
  font-size: 32px;
}

/* OAuth Integrations framework: logo container */
.integration-logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  background: var(--surface-muted, #f5f7fb);
  border-radius: 8px;
}
.integration-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.integration-logo-wrapper.integration-logo-wrapper-lg {
  width: 96px;
  height: 96px;
}

/* Add to matter contacts modal: prevent backdrop flashing and ensure modal is clickable (moved to body by JS) */
#summary-contacts-add-modal.modal {
  z-index: 1060 !important;
}
#summary-contacts-add-modal .modal-dialog {
  z-index: 1061 !important;
  position: relative;
}
#summary-contacts-add-modal .modal-content {
  pointer-events: auto !important;
}

/*
 * SHARED PENCIL EDIT CONTROL (Core Lexes)
 * Appearance + position live here only. Do not re-declare placement in templates.
 *
 * Position rule: pencil sits immediately after its title/label text with a tight
 * ~0.2rem gap. Action controls (+ADD, +LOG, Close, carets) stay on the far right
 * via existing flex-grow spacers / their own classes — this block does not move them.
 */
button.summary-detail-edit,
button.summary-contact-edit,
button.summary-adverse-edit,
a.summary-contact-edit,
button.summary-details-banner-edit,
button.clx-fc-header-edit {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  align-self: center !important;
  flex: 0 0 auto !important;
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  min-height: 26px !important;
  padding: 0 !important;
  line-height: 1 !important;
  /* Default tight attach when parent has no Bootstrap gap utility */
  margin: 0 0 0 0.2rem !important;
  position: static !important;
  float: none !important;
  order: 0 !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  color: #c9a227 !important;
  -webkit-text-fill-color: #c9a227 !important;
  background: #000000 !important;
  background-color: #000000 !important;
  border: 1.5px solid #c9a227 !important;
  border-radius: 2px !important;
  box-shadow: none !important;
  text-decoration: none !important;
  cursor: pointer;
  box-sizing: border-box !important;
}
/* Parent gap-2 (0.5rem) already separates title→pencil; cancel most of it → net ~0.2rem */
.gap-2 > :is(.summary-details-banner-edit, .clx-fc-header-edit, .summary-detail-edit, .summary-contact-edit, .summary-adverse-edit),
.d-flex.gap-2 > :is(.summary-details-banner-edit, .clx-fc-header-edit, .summary-detail-edit, .summary-contact-edit, .summary-adverse-edit) {
  margin-left: calc(0.2rem - 0.5rem) !important;
}
.gap-1 > :is(.summary-details-banner-edit, .clx-fc-header-edit, .summary-detail-edit, .summary-contact-edit, .summary-adverse-edit),
.d-flex.gap-1 > :is(.summary-details-banner-edit, .clx-fc-header-edit, .summary-detail-edit, .summary-contact-edit, .summary-adverse-edit) {
  margin-left: calc(0.2rem - 0.25rem) !important;
}
/* Title / label immediately before a pencil must not grow into empty header space */
:is(.card-header, .clx-card-header, .modal-header, .clx-fc-modal-hdr)
  > :is(span, .clx-card-title, .modal-title, h1, h2, h3, h4, h5, h6):has(
    + :is(.summary-details-banner-edit, .clx-fc-header-edit, .summary-detail-edit, .summary-contact-edit, .summary-adverse-edit)
  ),
.modal-header .d-flex > .modal-title:has(+ :is(.summary-details-banner-edit, .clx-fc-header-edit)),
.clx-fc-modal-hdr .d-flex > .modal-title:has(+ :is(.summary-details-banner-edit, .clx-fc-header-edit)) {
  flex: 0 1 auto !important;
  width: auto !important;
  max-width: calc(100% - 2.75rem);
  min-width: 0;
}
/* Title+pencil cluster inside a growing header row: pack left; leave room for Close / actions */
.modal-header .d-flex:has(> .modal-title):has(> :is(.summary-details-banner-edit, .clx-fc-header-edit)),
.clx-fc-modal-hdr .d-flex:has(> .modal-title):has(> :is(.summary-details-banner-edit, .clx-fc-header-edit)) {
  justify-content: flex-start !important;
  gap: 0.2rem !important;
}
.modal-header .d-flex:has(> .modal-title):has(> :is(.summary-details-banner-edit, .clx-fc-header-edit))
  > :is(.summary-details-banner-edit, .clx-fc-header-edit),
.clx-fc-modal-hdr .d-flex:has(> .modal-title):has(> :is(.summary-details-banner-edit, .clx-fc-header-edit))
  > :is(.summary-details-banner-edit, .clx-fc-header-edit) {
  margin-left: 0 !important; /* cluster gap handles spacing */
}
button.summary-detail-edit:hover:not(:disabled),
button.summary-contact-edit:hover:not(:disabled),
button.summary-adverse-edit:hover:not(:disabled),
a.summary-contact-edit:hover,
button.summary-details-banner-edit:hover:not(:disabled),
button.clx-fc-header-edit:hover:not(:disabled) {
  color: #c9a227 !important;
  -webkit-text-fill-color: #c9a227 !important;
  background: #000000 !important;
  background-color: #000000 !important;
  border-color: #e0b83d !important;
}
.summary-pencil-icon,
.summary-details-banner-edit-icon {
  color: #c9a227 !important;
  -webkit-text-fill-color: #c9a227 !important;
  background: transparent !important;
  stroke: #c9a227 !important;
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0;
}
button.clx-fc-header-edit.clx-fc-header-edit-hidden {
  display: none !important;
}

/* ── Contacts box: section headers ── */
.clx-contacts-section-hdr {
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
  font-weight: bold !important;
  color: #000 !important;
  margin-top: 6px;
  margin-bottom: 4px;
  padding-left: 2px;
}

/* ── Click-to-call tel links ── */
.clx-tel-link {
  color: inherit !important;
  text-decoration: underline !important;
  cursor: pointer !important;
}
.clx-tel-link:hover {
  color: #8C5E3C !important;
}

/* ── Court interactive link ── */
.clx-court-link {
  color: #000 !important;
  text-decoration: underline !important;
  cursor: pointer !important;
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
}
.clx-court-link:hover {
  color: #8C5E3C !important;
}

/* ── Court popover ── */
.clx-court-popover {
  position: absolute;
  z-index: 1070;
  background: #fff;
  border: 1px solid #000;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  padding: 12px 16px;
  max-width: 360px;
  min-width: 220px;
  font-family: "Times New Roman", Times, serif !important;
  font-size: 12pt !important;
}
.clx-court-popover-name {
  font-weight: bold !important;
  font-size: 12pt !important;
  margin-bottom: 6px;
  border-bottom: 1px solid #eee;
  padding-bottom: 4px;
}
.clx-court-popover-row {
  margin-bottom: 3px;
  font-size: 12pt !important;
}
.clx-court-popover-row a {
  color: #8C5E3C !important;
  text-decoration: underline !important;
}

/* ══════════════════════════════════════════════════════════════════════════
   Sprint 8 — Hardening: Unified Intelligence Module Styles
   PI + SSDI/SSI subtabs + Executive Dashboard ONLY
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Severity color standardization ── */
.clx-sev-info    { background: #6c757d !important; color: #fff !important; }
.clx-sev-warning { background: #fd7e14 !important; color: #fff !important; }
.clx-sev-critical{ background: #dc3545 !important; color: #fff !important; }

/* ── Uniform rounded badges ── */
.clx-intel-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 10pt;
  font-weight: bold;
  font-family: "Times New Roman", Times, serif;
  white-space: nowrap;
  vertical-align: middle;
}
.clx-intel-badge.badge-high-value     { background: #198754; color: #fff; }
.clx-intel-badge.badge-low-roi        { background: #dc3545; color: #fff; }
.clx-intel-badge.badge-erisa          { background: #6f42c1; color: #fff; }
.clx-intel-badge.badge-medicare       { background: #0d6efd; color: #fff; }
.clx-intel-badge.badge-medicaid       { background: #0dcaf0; color: #000; }
.clx-intel-badge.badge-treatment-gap  { background: #ffc107; color: #000; }
.clx-intel-badge.badge-inactivity     { background: #dc3545; color: #fff; }
.clx-intel-badge.badge-neg-health     { border-radius: 50%; width: 14px; height: 14px; padding: 0; }
.clx-intel-badge.badge-neg-green      { background: #198754; }
.clx-intel-badge.badge-neg-yellow     { background: #ffc107; }
.clx-intel-badge.badge-neg-red        { background: #dc3545; }

/* ── Consistent intelligence section header ── */
.clx-intel-section-hdr {
  background: var(--primary-banner-bg, #0f172a) !important;
  color: #fff !important;
  padding: 8px 14px !important;
  font-weight: bold !important;
  font-size: 12pt !important;
  font-family: "Times New Roman", Times, serif !important;
  border-radius: 4px 4px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.clx-intel-section-hdr .clx-intel-subtext {
  font-weight: normal;
  font-size: 10pt;
  color: #ccc;
  margin-left: 12px;
}
.clx-intel-section-hdr .clx-intel-hdr-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Loading spinner for intelligence modules ── */
.clx-intel-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: #666;
  font-style: italic;
}
.clx-intel-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #ddd;
  border-top-color: var(--primary-banner-bg, #0f172a);
  border-radius: 50%;
  animation: clxSpin 0.7s linear infinite;
  margin-right: 10px;
}
@keyframes clxSpin {
  to { transform: rotate(360deg); }
}

/* ── Responsive table wrapper ── */
.clx-intel-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.clx-intel-table-wrap table {
  min-width: 600px;
}

/* ── Mobile / tablet adjustments for intelligence modules ── */
@media (max-width: 992px) {
  .ci-kv-label { min-width: 140px; }
  .ci-score-ring { width: 56px; height: 56px; font-size: 18pt; }
  .rd-stats-row { gap: 10px; }
  .rd-stat-card { min-width: 110px; padding: 8px 10px; }
  .eid-kpi { min-width: 130px; }
  .eid-pipeline-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important; }
  .neg-analytics-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important; }
}
@media (max-width: 768px) {
  .ci-section-body { padding: 10px; }
  .rd-section-body { padding: 10px; }
  .rd-field-row { flex-direction: column; }
  .rd-milestone-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .eid-filters { flex-direction: column !important; }
  .eid-kpi { min-width: 100%; }
  .neg-edit-modal { width: 96vw !important; }
  .ci-gap-table th:nth-child(4), .ci-gap-table td:nth-child(4) { display: none; }
}
@media (max-width: 576px) {
  .clx-intel-section-hdr { flex-direction: column; align-items: flex-start; gap: 4px; }
  .clx-intel-section-hdr .clx-intel-hdr-actions { width: 100%; justify-content: flex-end; }
  .eid-tbl th, .eid-tbl td { font-size: 10pt !important; padding: 4px 6px !important; }
}

/* ========== Site-Wide Color Standardization (Navy + Light Blue-Grey) ========== */
:root {
  --clx-standard-navy: var(--chrome-sidebar-bg, #0f172a);
  --clx-standard-light-bg: #F0ECEB;
}

/* Replace black bars/banners/toolbars with sidebar navy */
.card-header,
.clx-card-header,
.app-main-header,
.ar-hdr,
.bl-hdr,
.gt-hdr,
.agenda-header,
.dashboard-header,
.workspace-card .card-header,
.ar-editor-toolbar,
[style*="background:#000"],
[style*="background: #000"],
[style*="background-color:#000"],
[style*="background-color: #000"],
[style*="background:#000000"],
[style*="background: #000000"],
[style*="background-color:#000000"],
[style*="background-color: #000000"] {
  background: var(--clx-standard-navy) !important;
  background-color: var(--clx-standard-navy) !important;
  border-color: var(--clx-standard-navy) !important;
  color: #fff !important;
}

/* Replace tan/cream/gold/brown backgrounds with standard light blue-grey */
.ar-editor-page,
.da-page,
.gt-page,
.bl-page,
.workspace-dashboard,
[style*="#f7f4eb"],
[style*="#ede6d6"],
[style*="#e8dfc8"],
[style*="#fffef8"],
[style*="#faf8f2"],
[style*="#f0ebe0"],
[style*="#d9d0bc"],
[style*="#c9a227"],
[style*="#b8a88a"] {
  background: var(--clx-standard-light-bg) !important;
  background-color: var(--clx-standard-light-bg) !important;
}

/* Keep core content surfaces white */
.card-body,
.table,
.table-responsive,
.modal-content,
.documents-doc-row,
.ar-document-page {
  background-color: #fff !important;
}

/* Buttons site-wide use sidebar navy (matter-subtab gold CTAs exempt) */
.btn:not(.clx-ms-btn-gold),
button.btn:not(.clx-ms-btn-gold),
input.btn:not(.clx-ms-btn-gold),
button[type="button"].btn:not(.clx-ms-btn-gold),
button[type="submit"].btn:not(.clx-ms-btn-gold),
.btn-dark:not(.clx-ms-btn-gold),
.btn-primary:not(.clx-ms-btn-gold),
.btn-outline-dark:not(.clx-ms-btn-gold),
.btn-outline-primary:not(.clx-ms-btn-gold) {
  background: var(--clx-standard-navy) !important;
  background-color: var(--clx-standard-navy) !important;
  border-color: var(--clx-standard-navy) !important;
  color: #fff !important;
}

/* Template editor toolbar controls match sidebar navy */
.ar-editor-toolbar .btn,
.ar-editor-toolbar select,
.ar-editor-toolbar .form-control-color {
  background: var(--clx-standard-navy) !important;
  color: #fff !important;
  border-color: var(--clx-standard-navy) !important;
}

/* ========== NEEDS ATTENTION — shared header centering (site-wide) ==========
   Use .clx-attention-host on any header/banner with left title, centered
   NEEDS ATTENTION (.clx-needs-attention-center), and right actions.
   Equal side columns (1fr | auto | 1fr) keep the badge mathematically centered
   regardless of left/right content width. */
.clx-attention-host {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.5rem;
  row-gap: 0.2rem;
  position: relative;
}
.clx-attention-host__left {
  grid-column: 1;
  justify-self: start;
  min-width: 0;
  max-width: 100%;
}
.clx-attention-host__center {
  grid-column: 2;
  justify-self: center;
  align-self: center;
  min-width: 0;
  text-align: center;
}
.clx-attention-host__right {
  grid-column: 3;
  justify-self: end;
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}
/* Prevent global .clx-card-header .clx-card-title { flex: 1 } from skewing the grid */
.clx-attention-host .clx-card-title {
  flex: 0 1 auto !important;
}
.clx-needs-attention-center {
  display: inline-block;
  margin: 0;
  white-space: nowrap;
  font-family: "Times New Roman", Times, serif !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: #c40000 !important;
  pointer-events: none;
}
/* Navy/black card banners: keep badge readable on dark chrome */
.clx-card-header .clx-needs-attention-center,
.card-header .clx-needs-attention-center,
.clx-navy-hdr .clx-needs-attention-center {
  background: #fff !important;
  color: #c40000 !important;
  font-size: 9pt !important;
  padding: 0.12rem 0.5rem;
}
@media (max-width: 720px) {
  .clx-attention-host {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .clx-attention-host__left {
    grid-column: 1;
    grid-row: 1;
  }
  .clx-attention-host__right {
    grid-column: 2;
    grid-row: 1;
  }
  .clx-attention-host__center {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }
}

/* Shared matter insurance — File Contacts + PI (Coverage / Adjuster blocks) */
.clx-mi-coverage-hdr {
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  font-weight: 700;
  color: #0f172a;
  margin: 6px 0 4px;
}
.clx-mi-cov-table {
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  margin-bottom: 0.25rem;
}
.clx-mi-cov-table th {
  background: #0f172a;
  color: #fff !important;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 0;
}
.clx-mi-cov-table td {
  padding: 2px 6px;
  vertical-align: middle;
}
.clx-mi-adj-child {
  margin: 4px 0 4px 12px;
  padding: 4px 8px;
  border-left: 3px solid #c9a227;
  background: #f8fafc;
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
}
.clx-mi-adj-name { font-weight: 700; }
.clx-mi-adj-meta,
.clx-mi-adj-handles { color: #334155; }
.clx-mi-carrier-extras {
  border-top: 1px solid #e2e8f0;
  max-height: 14rem;
  overflow-y: auto;
}
.clx-mi-pi-carrier {
  border: 1px solid #e2e8f0;
  padding: 6px 8px;
  background: #fff;
}


/* Phase 1 final viewport lock — fill pages stay within 100dvh; content scrolls inside */
body.clx-tasks-page .app-page-wrapper,
body.clx-matters-page .app-page-wrapper,
body.clx-templates-page .app-page-wrapper,
body.clx-dd-page:has(#clx-ca-ws) .app-page-wrapper,
body.clx-ws-page:has(#clx-access-ws) .app-page-wrapper {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
body.clx-tasks-page .app-main,
body.clx-matters-page .app-main,
body.clx-templates-page .app-main,
body.clx-dd-page:has(#clx-ca-ws) .app-main,
body.clx-ws-page:has(#clx-access-ws) .app-main {
  min-height: 0;
  overflow: hidden;
  height: auto;
  max-height: none;
}
