/* RIDER TECH CRM — All custom styles
   Page scopes prevent login/portal styles from affecting the CRM.
   Bootstrap and Bootstrap Icons remain external vendor dependencies.
*/

/* =========================================================
   Base CRM CSS
   ========================================================= */
/* =========================================================
   GLOBAL VARIABLES
   ========================================================= */
:root:where(:has(body.crm-shell)) {
  --nav-h: 56px;
  /* Navbar height */
  --side-w: 240px;
  /* Sidebar width */
  --cut: 0.5rem;
  /* Corner radius */
  --page-bg: #f6f9ff;
  /* Light background */
}

/* Font stack uses locally available fonts. */

/* =========================================================
   GLOBAL BASE STYLES
   ========================================================= */
:where(:root:has(body.crm-shell)) body {
  background-color: var(--page-bg);
  color: #000;
  font-family: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Corner chips and connecting lines */
:where(:root:has(body.crm-shell)) body::after,
:where(:root:has(body.crm-shell)) body::before,
:where(:root:has(body.crm-shell)) .sidebar-line,
:where(:root:has(body.crm-shell)) .top-line,
:where(:root:has(body.crm-shell)) .bottom-line {
  background: var(--page-bg);
  pointer-events: none;
  z-index: 1035;
}

/* Top-left inside corner chip */
:where(:root:has(body.crm-shell)) body::after {
  content: "";
  position: fixed;
  top: calc(var(--nav-h) - var(--cut) + 6px);
  left: calc(var(--side-w) - var(--cut) + 6px);
  width: var(--cut);
  height: var(--cut);
  border-top-left-radius: var(--cut);
}

/* Bottom-left inside corner chip */
:where(:root:has(body.crm-shell)) body::before {
  content: "";
  position: fixed;
  bottom: calc(0px - var(--cut) + 62px);
  left: calc(var(--side-w) - var(--cut) + 6px);
  width: var(--cut);
  height: var(--cut);
  border-bottom-left-radius: var(--cut);
}

:where(:root:has(body.crm-shell)) .col-xl-10 {
  width: 87.3% !important;
}

/* Vertical divider next to sidebar */
:where(:root:has(body.crm-shell)) .sidebar-line {
  content: "";
  position: fixed;
  top: calc(var(--nav-h) + 3px);
  left: calc(var(--side-w) - 2px);
  width: 2px;
  height: calc(100vh - var(--nav-h) - 64px);
}

/* Top horizontal divider */
:where(:root:has(body.crm-shell)) .top-line {
  content: "";
  position: fixed;
  top: calc(var(--nav-h) - 2px);
  left: calc(var(--side-w) + 6px);
  width: calc(100% - var(--side-w) - 6px);
  height: 2px;
}

/* Bottom horizontal divider */
:where(:root:has(body.crm-shell)) .bottom-line {
  content: "";
  position: fixed;
  bottom: calc(62px - 8px);
  left: calc(var(--side-w) + 6px);
  width: calc(100% - var(--side-w) - 6px);
  height: 2px;
}

/* =========================================================
   STATUS COLORS & UTILITIES
   ========================================================= */
:where(:root:has(body.crm-shell)) .bg-purple {
  background-color: #6f42c1 !important;
  color: #fff !important;
}

:where(:root:has(body.crm-shell)) .status-waiting {
  background-color: #6f42c1 !important;
  /* Waiting On Customer – purple */
  color: #fff !important;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
:where(:root:has(body.crm-shell)) .sidebar {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  width: var(--side-w);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  background-color: #081735;
  z-index: 1020;
}

:where(:root:has(body.crm-shell)) .sidebar .nav-link {
  color: #cbd5e1;
  font-weight: 500;
}

:where(:root:has(body.crm-shell)) .sidebar .nav-link.active {
  color: #fff !important;
  font-weight: 600;
  background: linear-gradient(90deg, rgba(75, 108, 183, 0.25), rgba(24, 40, 72, 0.25));
  border-left: 3px solid #4b6cb7;
}

:where(:root:has(body.crm-shell)) .sidebar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* =========================================================
   SIDEBAR GROUP HEADINGS & SECTIONS
   ========================================================= */
:where(:root:has(body.crm-shell)) .sidebar-heading {
  letter-spacing: 0.05em;
  color: #fff !important;
  text-transform: uppercase;
  font-size: 0.7rem;
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}

:where(:root:has(body.crm-shell)) .sidebar .nav-link {
  border-radius: 4px;
  margin-bottom: 2px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

:where(:root:has(body.crm-shell)) .sidebar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

:where(:root:has(body.crm-shell)) .sidebar .nav-link.active {
  background: linear-gradient(90deg,
      rgba(75, 108, 183, 0.25) 0%,
      rgba(24, 40, 72, 0.25) 100%);
  border-left: 3px solid #4b6cb7;
  color: #fff !important;
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */
:where(:root:has(body.crm-shell)) main {
  margin-left: var(--side-w);
  padding: 1.5rem;
  padding-bottom: 80px;
}

:where(:root:has(body.crm-shell)) .card-header h5,
:where(:root:has(body.crm-shell)) .card-header h6 {
  color: #31486f;
  /* Rider Tech blue tone */
}

:where(:root:has(body.crm-shell)) .text-primary {
  color: #31486f !important;
}

:where(:root:has(body.crm-shell)) .clickable-row {
  cursor: pointer;
}

:where(:root:has(body.crm-shell)) .clickable-row:hover {
  background-color: #f8f9fa;
  /* Bootstrap table-light shade */
}

/* =========================================================
   FOOTER
   ========================================================= */
:where(:root:has(body.crm-shell)) footer.footer {
  position: fixed;
  bottom: 0;
  left: var(--side-w);
  width: calc(100% - var(--side-w));
  background-color: #31486f;
  color: #fff;
  padding: 0.75rem 1rem;
  text-align: center;
  z-index: 1010;
}

/* =========================================================
   CARDS
   ========================================================= */
:where(:root:has(body.crm-shell)) .card {
  border-radius: 0.5rem;
  border: none;
}

/* .card:hover {
  transform: translateY(-3px);
} */
:where(:root:has(body.crm-shell)) .card-title {
  font-size: 0.9rem;
  font-weight: 600;
}

:where(:root:has(body.crm-shell)) .card h2 {
  font-weight: bold;
  color: #31486f;
}

/* Card iframes */
:where(:root:has(body.crm-shell)) .card-body iframe {
  border-radius: 0.5rem;
  filter: brightness(0.98);
}

:where(:root:has(body.crm-shell)) .card-body iframe:hover {
  filter: brightness(1);
}

/* Scrollable Recent Activity card body */
:where(:root:has(body.crm-shell)) .card-body.activity-log {
  max-height: 480px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 0.5rem;
}

:where(:root:has(body.crm-shell)) .activity-log .list-group-item {
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  white-space: normal;
}

/* Clickable summary cards */
:where(:root:has(body.crm-shell)) .hover-card {
  cursor: pointer !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

:where(:root:has(body.crm-shell)) .hover-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* =========================================================
   TABLES
   ========================================================= */
:where(:root:has(body.crm-shell)) .table th {
  font-weight: 600;
}

:where(:root:has(body.crm-shell)) .table td {
  vertical-align: middle;
}

/* =========================================================
   NAVBAR
   ========================================================= */
:where(:root:has(body.crm-shell)) .navbar-dark {
  background-color: #081735 !important;
}

:where(:root:has(body.crm-shell)) #customerSearch {
  border-radius: 50px !important;
  /* box-shadow: 0 0 6px rgba(0,0,0,0.1); */
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* =========================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================= */
@media (max-width: 1200px) {
  :root:where(:has(body.crm-shell)) {
    --side-w: 200px;
  }

  :where(:root:has(body.crm-shell)) .sidebar {
    display: none !important;
  }

  :where(:root:has(body.crm-shell)) .sidebar.open {
    left: 0;
  }

  :where(:root:has(body.crm-shell)) main {
    margin-left: 0;
    padding: 1rem;
    padding-bottom: 100px !important;
  }

  :where(:root:has(body.crm-shell)) footer.footer {
    left: 0;
    width: 100%;
  }

  /* Hide lines and chips on smaller screens */
  :where(:root:has(body.crm-shell)) body::before,
  :where(:root:has(body.crm-shell)) body::after,
  :where(:root:has(body.crm-shell)) .sidebar-line,
  :where(:root:has(body.crm-shell)) .top-line,
  :where(:root:has(body.crm-shell)) .bottom-line {
    display: none !important;
  }

  :where(:root:has(body.crm-shell)) .navbar-dark .navbar-nav .nav-link {
    color: #cbd5e1;
    padding: 0.6rem 1rem;
    border-left: 3px solid transparent;
  }

  :where(:root:has(body.crm-shell)) .navbar-dark .navbar-nav .nav-link.active {
    border-left-color: #4b6cb7;
    background: linear-gradient(90deg,
        rgba(75, 108, 183, 0.15) 0%,
        rgba(24, 40, 72, 0.15) 100%);
    color: #fff;
  }

  :where(:root:has(body.crm-shell)) .navbar-dark .navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
  }
}

/* Reset for smaller screens */
@media (max-width: 1199.98px) {
  :where(:root:has(body.crm-shell)) .col-xl-10 {
    width: 100% !important;
  }
}

/* =========================================================
   LAPTOP FIX: 1200px–1599px viewport widths
   ========================================================= */
@media (min-width: 1200px) and (max-width: 1599px) {

  /* Remove Bootstrap row gutters */
  :where(:root:has(body.crm-shell)) .container-fluid>.row {
    margin-right: 0 !important;
    margin-left: 0 !important;
  }

  /* Fix main alignment and prevent overflow */
  :where(:root:has(body.crm-shell)) main.col-xl-10 {
    margin-left: var(--side-w) !important;
    width: calc(100% - var(--side-w)) !important;
    max-width: calc(100% - var(--side-w)) !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  /* Keep navbar pinned at top */
  :where(:root:has(body.crm-shell)) .navbar.sticky-top {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1040;
  }

  /* ✅ Push main content below fixed navbar */
  :where(:root:has(body.crm-shell)) main {
    margin-top: var(--nav-h) !important;
  }

  /* Align footer with sidebar */
  :where(:root:has(body.crm-shell)) footer.footer {
    left: var(--side-w);
    width: calc(100% - var(--side-w));
  }

  /* Final safeguard */
  html:where(:has(body.crm-shell)),
  :where(:root:has(body.crm-shell)) body {
    overflow-x: hidden;
  }
}

@media (max-width: 768px) {
  :root:where(:has(body.crm-shell)) {
    --nav-h: 52px;
  }

  :where(:root:has(body.crm-shell)) .navbar-brand {
    font-size: 1rem;
  }

  :where(:root:has(body.crm-shell)) .card {
    margin-bottom: 1rem;
  }

  :where(:root:has(body.crm-shell)) main {
    margin-left: 0;
    padding: 1rem;
    padding-bottom: 100px !important;
  }

  :where(:root:has(body.crm-shell)) .table-responsive {
    overflow-x: auto;
  }

  :where(:root:has(body.crm-shell)) footer.footer {
    font-size: 0.8rem;
    padding: 0.5rem;
  }

  /* =========================================================
     SEARCH BAR RESPONSIVE STYLING (TABLETS)
     ========================================================= */
  :where(:root:has(body.crm-shell)) #customerSearchGroup {
    max-width: 100%;
    margin-bottom: 1rem;
  }

  :where(:root:has(body.crm-shell)) #customerSearch {
    border-radius: 50px !important;
    font-size: 1rem;
    padding: 0.6rem 1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  }

  :where(:root:has(body.crm-shell)) #customerSearch::placeholder {
    font-size: 0.95rem;
    color: #777;
  }

  :where(:root:has(body.crm-shell)) #customerSearchGroup .input-group-text {
    border-radius: 50px 0 0 50px !important;
    padding-left: 1rem;
    background-color: #fff;
  }
}

@media (max-width: 576px) {
  :where(:root:has(body.crm-shell)) main {
    padding: 0.75rem;
  }

  :where(:root:has(body.crm-shell)) h1.h2,
  :where(:root:has(body.crm-shell)) .h2 {
    font-size: 1.25rem;
  }

  :where(:root:has(body.crm-shell)) .card-title {
    font-size: 0.85rem;
  }

  :where(:root:has(body.crm-shell)) .card h2 {
    font-size: 1.5rem;
  }

  /* =========================================================
     SEARCH BAR RESPONSIVE STYLING (PHONES)
     ========================================================= */
  :where(:root:has(body.crm-shell)) #customerSearchGroup {
    max-width: 100%;
  }

  :where(:root:has(body.crm-shell)) #customerSearch {
    padding: 0.5rem 0.9rem;
    font-size: 0.95rem;
  }

  :where(:root:has(body.crm-shell)) #customerSearchGroup .input-group-text i {
    font-size: 0.9rem;
  }
}

/* Employee Disable: orange outline, white text on orange hover. */
:where(:root:has(body.crm-shell)) .btn-disable-user {
  --bs-btn-color: #d35400;
  --bs-btn-border-color: #d35400;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #d35400;
  --bs-btn-hover-border-color: #d35400;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #d35400;
  --bs-btn-active-border-color: #d35400;
  --bs-btn-focus-shadow-rgb: 211, 84, 0;
}


/* =========================================================
   Meeting Room CSS
   ========================================================= */
/* Meeting-only layout: original CRM palette and navigation remain unchanged. */
:where(:root:has(body.crm-shell)) .meeting-page {
  padding-bottom: 24px !important;
}

:where(:root:has(body.crm-shell)) .meeting-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

:where(:root:has(body.crm-shell)) .meeting-heading p {
  font-size: .9rem;
}

:where(:root:has(body.crm-shell)) .meeting-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: clamp(100px, calc(50dvh - 170px), 260px);
  gap: 1rem;
}

:where(:root:has(body.crm-shell)) .meeting-tile {
  position: relative;
  height: 100%;
  min-height: 0;
  min-width: 0;
  background: #14233c;
  color: white;
  border: 3px solid transparent;
  border-radius: .65rem;
  overflow: hidden;
}

:where(:root:has(body.crm-shell)) .meeting-tile.speaking {
  border-color: #42c785;
  box-shadow: 0 0 0 2px #42c78540;
}

:where(:root:has(body.crm-shell)) .meeting-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

:where(:root:has(body.crm-shell)) .meeting-tile.self video {
  transform: scaleX(-1);
}

:where(:root:has(body.crm-shell)) .meeting-avatar {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  font-weight: 600;
  background: #14233c;
}

:where(:root:has(body.crm-shell)) .meeting-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .6rem .75rem;
  background: rgba(0, 0, 0, .72);
  font-size: .85rem;
}

:where(:root:has(body.crm-shell)) .meeting-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:where(:root:has(body.crm-shell)) .meeting-state {
  font-size: .75rem;
  flex-shrink: 0;
}

:where(:root:has(body.crm-shell)) .meeting-shares {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

:where(:root:has(body.crm-shell)) .meeting-screen {
  background: #14233c;
  border-radius: .6rem;
  overflow: hidden;
  color: #fff;
}

:where(:root:has(body.crm-shell)) .meeting-screen video {
  width: 100%;
  max-height: 62vh;
  display: block;
  object-fit: contain;
}

:where(:root:has(body.crm-shell)) .meeting-screen header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem 1rem;
}

:where(:root:has(body.crm-shell)) .meeting-page [hidden] {
  display: none !important;
}

:where(:root:has(body.crm-shell)) .meeting-page .btn:focus-visible {
  outline: 3px solid #86b7fe;
  outline-offset: 2px;
}

@media(min-width:1200px) {
  :where(:root:has(body.crm-shell)) main.meeting-page {
    width: calc(100% - var(--side-w)) !important;
    max-width: calc(100% - var(--side-w));
    margin-left: var(--side-w) !important;
  }
}

@media(max-width:991.98px) {
  :where(:root:has(body.crm-shell)) .meeting-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media(max-width:575.98px) {
  :where(:root:has(body.crm-shell)) .meeting-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  :where(:root:has(body.crm-shell)) .meeting-heading {
    align-items: flex-start;
  }

  :where(:root:has(body.crm-shell)) .meeting-controls .ms-auto {
    margin-left: 0 !important;
  }
}

:where(:root:has(body.crm-shell)) .meeting-shares:empty {
  display: none;
}

@media(max-width:991.98px) {
  :where(:root:has(body.crm-shell)) .meeting-grid {
    grid-auto-rows: 200px;
  }
}

@media(max-width:575.98px) {
  :where(:root:has(body.crm-shell)) .meeting-grid {
    grid-auto-rows: 220px;
  }
}

/* Reserve the viewport for the meeting, with controls beside the title. */
:where(:root:has(body.crm-shell)) body.crm-shell:has(.meeting-page) {
  padding-bottom: 0;
}

:where(:root:has(body.crm-shell)) .crm-shell main.meeting-page {
  height: calc(100dvh - var(--nav-h) - var(--shell-footer-h));
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding-top: 16px;
  padding-bottom: 12px !important;
  box-sizing: border-box;
}

:where(:root:has(body.crm-shell)) .meeting-page .meeting-heading {
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
  margin-bottom: 0 !important;
  padding-bottom: 12px !important;
}

:where(:root:has(body.crm-shell)) .meeting-heading>div:first-child {
  margin-right: auto;
}

:where(:root:has(body.crm-shell)) .meeting-heading p {
  display: none;
}

:where(:root:has(body.crm-shell)) .meeting-controls {
  margin-left: auto;
}

:where(:root:has(body.crm-shell)) .meeting-page #meeting-join-panel,
:where(:root:has(body.crm-shell)) .meeting-page #meeting-message {
  margin-bottom: 0 !important;
  flex-shrink: 0;
}

:where(:root:has(body.crm-shell)) .meeting-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
}

:where(:root:has(body.crm-shell)) .meeting-stage:not(:has(.meeting-tile)) {
  display: none;
}

:where(:root:has(body.crm-shell)) .meeting-stage .meeting-grid {
  min-height: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-rows: initial;
  gap: 12px;
}

:where(:root:has(body.crm-shell)) .meeting-stage .meeting-shares {
  display: none;
  margin: 0;
  min-height: 0;
}

:where(:root:has(body.crm-shell)) .meeting-stage:has(.meeting-screen:not([hidden])) {
  grid-template-rows: minmax(0, 1fr) minmax(0, 140px);
}

:where(:root:has(body.crm-shell)) .meeting-stage:has(.meeting-screen:not([hidden])) .meeting-shares {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 12px;
}

:where(:root:has(body.crm-shell)) .meeting-stage:has(.meeting-screen:not([hidden])) .meeting-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
}

:where(:root:has(body.crm-shell)) .meeting-stage .meeting-screen {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

:where(:root:has(body.crm-shell)) .meeting-stage .meeting-screen header {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: .8rem;
}

:where(:root:has(body.crm-shell)) .meeting-stage .meeting-screen video {
  flex: 1;
  min-height: 0;
  height: 0;
  max-height: none;
  width: 100%;
  object-fit: contain;
}

:where(:root:has(body.crm-shell)) .meeting-stage .meeting-label {
  padding: 5px 7px;
  font-size: .75rem;
  gap: 4px;
  flex-wrap: wrap;
}

:where(:root:has(body.crm-shell)) .meeting-stage .meeting-avatar {
  font-size: 1.6rem;
}

:where(:root:has(body.crm-shell)) .meeting-page .meeting-tip {
  margin: 0;
  font-size: .72rem;
  flex-shrink: 0;
}

:where(:root:has(body.crm-shell)) .meeting-page #meeting-empty {
  flex: 1;
  min-height: 0;
  justify-content: center;
}

@media(max-width:991.98px) {
  :where(:root:has(body.crm-shell)) .meeting-stage:has(.meeting-screen:not([hidden])) {
    grid-template-rows: minmax(0, 1fr) minmax(0, 180px);
  }

  :where(:root:has(body.crm-shell)) .meeting-stage:has(.meeting-screen:not([hidden])) .meeting-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
}

@media(max-width:575.98px) {
  :where(:root:has(body.crm-shell)) .crm-shell main.meeting-page {
    height: calc(100dvh - var(--nav-h) - 60px);
    gap: 8px;
    padding-top: 10px;
  }

  :where(:root:has(body.crm-shell)) .meeting-heading .meeting-controls {
    order: 3;
    width: 100%;
  }

  :where(:root:has(body.crm-shell)) .meeting-stage .meeting-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  :where(:root:has(body.crm-shell)) .meeting-stage:has(.meeting-screen:not([hidden])) {
    grid-template-rows: minmax(0, 1fr) minmax(0, 160px);
  }

  :where(:root:has(body.crm-shell)) .meeting-page .meeting-tip {
    display: none;
  }

  :where(:root:has(body.crm-shell)) .meeting-stage .meeting-state {
    font-size: .6rem;
  }
}

/* Very short windows can scroll rather than hide essential controls. */
@media(max-height:480px) {
  :where(:root:has(body.crm-shell)) .crm-shell main.meeting-page {
    min-height: 420px;
  }
}


/* =========================================================
   Header, Sidebar and Footer CSS
   ========================================================= */
/* Shared navigation palette. Page cards, forms and status colors stay in style.css. */
:root:where(:has(body.crm-shell)) {
  --shell-bg: #243b50;
  --shell-text: #e3ebf2;
  --shell-muted: #adc0d0;
  --shell-accent: #a5ded6;
  --shell-active: #365466;
  --shell-radius: 18px;
  --shell-gap: 12px;
  --nav-h: 54px;
  --side-w: 240px;
  --shell-footer-h: 48px;
}

:where(:root:has(body.crm-shell)) body.crm-shell {
  padding-top: calc(var(--nav-h) + 24px);
  padding-bottom: calc(var(--shell-footer-h) + 24px);
}

/* Replace the old corner chips with actual rounded navigation surfaces. */
:where(:root:has(body.crm-shell)) body.crm-shell::before,
:where(:root:has(body.crm-shell)) body.crm-shell::after {
  content: none;
}

:where(:root:has(body.crm-shell)) .crm-shell .sidebar-line,
:where(:root:has(body.crm-shell)) .crm-shell .top-line,
:where(:root:has(body.crm-shell)) .crm-shell .bottom-line {
  display: none;
}

:where(:root:has(body.crm-shell)) .crm-shell .crm-header,
:where(:root:has(body.crm-shell)) .crm-shell .sidebar,
:where(:root:has(body.crm-shell)) .crm-shell footer.crm-footer {
  background: var(--shell-bg) !important;
  color: var(--shell-text);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: var(--shell-radius);
  box-shadow: 0 5px 18px rgba(24, 43, 61, .10);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

:where(:root:has(body.crm-shell)) .crm-shell .crm-header.sticky-top {
  position: fixed !important;
  inset: 12px 12px auto;
  width: auto;
  min-height: var(--nav-h);
  padding: 10px 14px;
  z-index: 1040;
}

:where(:root:has(body.crm-shell)) .crm-header .navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -.025em;
  margin-right: 12px;
}

:where(:root:has(body.crm-shell)) .crm-brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--shell-active);
  color: var(--shell-accent);
  font-size: 1rem;
}

:where(:root:has(body.crm-shell)) .crm-brand-detail {
  font-size: .7rem;
  letter-spacing: .08em;
  color: var(--shell-muted);
  margin-left: 5px;
}

:where(:root:has(body.crm-shell)) .crm-header .dropdown-toggle {
  gap: 7px;
  max-width: 280px;
  font-size: .9rem;
}

:where(:root:has(body.crm-shell)) .crm-header .dropdown-toggle .bi {
  font-size: 1.2rem;
  color: var(--shell-accent);
}

:where(:root:has(body.crm-shell)) .crm-header .dropdown-menu {
  border: 1px solid #dfe6eb;
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 12px 36px #182b3d20;
}

:where(:root:has(body.crm-shell)) .crm-header .dropdown-item {
  border-radius: 8px;
  padding: 9px 12px;
  font-size: .9rem;
}

:where(:root:has(body.crm-shell)) .crm-header .navbar-toggler {
  border-color: #6e8597;
  border-radius: 10px;
  padding: 6px 9px;
}

:where(:root:has(body.crm-shell)) .crm-shell .sidebar {
  top: calc(var(--nav-h) + 24px);
  left: 12px;
  bottom: 12px;
  width: var(--side-w);
  height: auto;
  padding: 4px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #627c8e transparent;
  z-index: 1020;
}

:where(:root:has(body.crm-shell)) .crm-shell .sidebar .position-sticky {
  position: static !important;
  padding: 14px 10px !important;
}

:where(:root:has(body.crm-shell)) .crm-shell .sidebar-heading {
  color: var(--shell-muted) !important;
  font-size: .65rem;
  letter-spacing: .105em;
  font-weight: 600 !important;
  padding-left: 12px;
  margin-bottom: 10px !important;
}

:where(:root:has(body.crm-shell)) .crm-shell .sidebar .mb-4 {
  margin-bottom: 22px !important;
}

:where(:root:has(body.crm-shell)) .crm-shell .sidebar .nav-link,
:where(:root:has(body.crm-shell)) .crm-header .navbar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--shell-text);
  font-weight: 500;
  font-size: .9rem;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 12px;
  margin-bottom: 3px;
  transition: background-color .15s ease, color .15s ease;
}

:where(:root:has(body.crm-shell)) .crm-shell .sidebar .nav-link .bi,
:where(:root:has(body.crm-shell)) .crm-header #navbarMain>.navbar-nav.me-auto .bi {
  width: 20px;
  flex: 0 0 20px;
  font-size: 1.1rem;
  text-align: center;
  color: var(--shell-muted);
}

:where(:root:has(body.crm-shell)) .crm-shell .sidebar .nav-link:hover,
:where(:root:has(body.crm-shell)) .crm-header .navbar-nav .nav-link:hover {
  background: #304c61;
  color: #fff;
}

:where(:root:has(body.crm-shell)) .crm-shell .sidebar .nav-link.active,
:where(:root:has(body.crm-shell)) .crm-header .navbar-nav .nav-link.active {
  background: var(--shell-active);
  border: 1px solid #526f7e;
  color: #fff !important;
  font-weight: 600;
}

:where(:root:has(body.crm-shell)) .crm-shell .sidebar .nav-link.active .bi,
:where(:root:has(body.crm-shell)) .crm-header #navbarMain .nav-link.active .bi {
  color: var(--shell-accent);
}

:where(:root:has(body.crm-shell)) .crm-shell .sidebar a:focus-visible,
:where(:root:has(body.crm-shell)) .crm-header a:focus-visible,
:where(:root:has(body.crm-shell)) .crm-shell footer a:focus-visible {
  outline: 2px solid var(--shell-accent);
  outline-offset: 2px;
}

:where(:root:has(body.crm-shell)) .crm-shell main {
  margin-top: 0 !important;
  padding-bottom: 24px;
}

@media (min-width:1200px) {

  :where(:root:has(body.crm-shell)) .crm-shell main,
  :where(:root:has(body.crm-shell)) .crm-shell main.col-xl-10 {
    margin-left: calc(var(--side-w) + 24px) !important;
    width: calc(100% - var(--side-w) - 24px) !important;
    max-width: calc(100% - var(--side-w) - 24px) !important;
  }

  :where(:root:has(body.crm-shell)) .crm-shell .sidebar {
    display: block !important;
  }
}

:where(:root:has(body.crm-shell)) .crm-shell footer.crm-footer {
  position: fixed;
  left: calc(var(--side-w) + 24px);
  right: 12px;
  bottom: 12px;
  width: auto;
  height: var(--shell-footer-h);
  display: flex;
  align-items: center;
  padding: 8px 16px;
  z-index: 1030;
  font-size: .78rem;
  border-radius: 14px;
}

:where(:root:has(body.crm-shell)) .crm-footer .container-fluid {
  padding: 0;
}

:where(:root:has(body.crm-shell)) .crm-footer .crm-copyright {
  color: var(--shell-muted);
}

:where(:root:has(body.crm-shell)) .crm-footer a {
  color: var(--shell-text) !important;
  white-space: nowrap;
}

:where(:root:has(body.crm-shell)) .crm-footer a:hover {
  color: var(--shell-accent) !important;
}

:where(:root:has(body.crm-shell)) .crm-footer .bi {
  color: var(--shell-accent);
  margin-right: 4px;
}

@media (max-width:1199.98px) {
  :where(:root:has(body.crm-shell)) .crm-shell main {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    padding-bottom: 24px !important;
  }

  :where(:root:has(body.crm-shell)) .crm-shell footer.crm-footer {
    left: 12px;
  }

  :where(:root:has(body.crm-shell)) .crm-header #navbarMain {
    max-height: calc(100dvh - 112px);
    overflow-y: auto;
    padding-top: 8px;
  }

  :where(:root:has(body.crm-shell)) .crm-header .dropdown-menu {
    position: absolute;
  }

  :where(:root:has(body.crm-shell)) .crm-header .sidebar-heading {
    margin-top: 4px;
  }
}

@media (max-width:575.98px) {
  :where(:root:has(body.crm-shell)) .crm-shell .crm-header.sticky-top {
    padding: 10px 8px;
  }

  :where(:root:has(body.crm-shell)) .crm-header>.container-fluid {
    padding: 0 4px;
  }

  :where(:root:has(body.crm-shell)) .crm-header .navbar-brand {
    font-size: .93rem;
    gap: 7px;
    margin-right: 4px;
  }

  :where(:root:has(body.crm-shell)) .crm-brand-mark {
    width: 30px;
    height: 32px;
    border-radius: 9px;
  }

  :where(:root:has(body.crm-shell)) .crm-brand-detail {
    display: none;
  }

  :where(:root:has(body.crm-shell)) .crm-header .dropdown-toggle {
    max-width: 130px;
    font-size: .78rem;
    padding: 8px 5px !important;
    gap: 4px;
  }

  :where(:root:has(body.crm-shell)) .crm-header .navbar-toggler {
    margin-left: 5px;
    padding: 4px 6px;
  }

  :where(:root:has(body.crm-shell)) .crm-header .navbar-toggler-icon {
    width: 1.3em;
    height: 1.3em;
  }

  :where(:root:has(body.crm-shell)) .crm-shell footer.crm-footer {
    height: 60px;
    padding: 8px 12px;
    font-size: .72rem;
  }

  :where(:root:has(body.crm-shell)) .crm-footer>.container-fluid {
    flex-wrap: wrap;
    justify-content: center !important;
    gap: 3px !important;
  }

  :where(:root:has(body.crm-shell)) .crm-footer .crm-copyright {
    width: 100%;
  }

  :where(:root:has(body.crm-shell)) body.crm-shell {
    padding-bottom: 84px;
  }
}

@media (prefers-reduced-motion:reduce) {

  :where(:root:has(body.crm-shell)) .crm-shell .sidebar .nav-link,
  :where(:root:has(body.crm-shell)) .crm-header .nav-link {
    transition: none;
  }
}

/* Keep the closed header within its reserved height, including long names. */
:where(:root:has(body.crm-shell)) .crm-header .navbar-brand {
  padding-top: 0;
  padding-bottom: 0;
}

:where(:root:has(body.crm-shell)) .crm-header .navbar-nav .dropdown-toggle {
  padding-top: 7px;
  padding-bottom: 7px;
  margin-bottom: 0;
}

:where(:root:has(body.crm-shell)) .crm-account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width:380px) {
  :where(:root:has(body.crm-shell)) .crm-header .crm-account-name {
    display: none;
  }
}

/* Connected frame with rounded corners on the inside of the workspace. */
:where(:root:has(body.crm-shell)) body.crm-shell {
  padding-top: var(--nav-h);
}

:where(:root:has(body.crm-shell)) .crm-shell .crm-header.sticky-top {
  inset: 0 0 auto;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

:where(:root:has(body.crm-shell)) .crm-shell .sidebar {
  top: var(--nav-h);
  left: 0;
  bottom: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

:where(:root:has(body.crm-shell)) .crm-shell footer.crm-footer {
  left: var(--side-w);
  right: 0;
  bottom: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

@media (min-width:1200px) {

  :where(:root:has(body.crm-shell)) .crm-shell main,
  :where(:root:has(body.crm-shell)) .crm-shell main.col-xl-10 {
    margin-left: var(--side-w) !important;
    width: calc(100% - var(--side-w)) !important;
    max-width: calc(100% - var(--side-w)) !important;
  }

  :where(:root:has(body.crm-shell)) body.crm-shell::before,
  :where(:root:has(body.crm-shell)) body.crm-shell::after {
    content: "";
    display: block !important;
    position: fixed;
    left: var(--side-w);
    width: 6px;
    height: 6px;
    border-radius: 0;
    pointer-events: none;
    z-index: 1035;
  }

  :where(:root:has(body.crm-shell)) body.crm-shell::after {
    top: var(--nav-h);
    bottom: auto;
    background: radial-gradient(circle at bottom right, transparent 5.5px, var(--shell-bg) 6px);
  }

  :where(:root:has(body.crm-shell)) body.crm-shell::before {
    top: auto;
    bottom: var(--shell-footer-h);
    background: radial-gradient(circle at top right, transparent 5.5px, var(--shell-bg) 6px);
  }
}

@media (max-width:1199.98px) {
  :where(:root:has(body.crm-shell)) .crm-shell footer.crm-footer {
    left: 0;
  }
}

/* Compact header and tighter workspace corners, matching the original frame. */
:where(:root:has(body.crm-shell)) .crm-shell .crm-header.sticky-top {
  padding-top: 6px;
  padding-bottom: 6px;
}

:where(:root:has(body.crm-shell)) .crm-header .crm-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

/* Anchor the upper inside corner to the actual bottom edge of the header. */
@media (min-width:1200px) {
  :where(:root:has(body.crm-shell)) body.crm-shell::after {
    content: none;
    display: none !important;
  }

  :where(:root:has(body.crm-shell)) .crm-shell .crm-header::after {
    content: "";
    position: absolute;
    top: 100%;
    left: var(--side-w);
    width: 6px;
    height: 6px;
    pointer-events: none;
    background: radial-gradient(circle at bottom right, transparent 5.5px, var(--shell-bg) 6px);
  }
}

/* Account menu: quiet identity panel and generous, aligned actions. */
:where(:root:has(body.crm-shell)) .crm-header .crm-account-menu {
  width: 260px;
  max-width: calc(100vw - 24px);
  padding: 8px;
  margin-top: 10px;
  background: #fff;
  border: 1px solid #dbe5eb;
  border-radius: 16px;
  box-shadow: 0 14px 38px rgba(24, 43, 61, .18);
  color: #243b50;
}

:where(:root:has(body.crm-shell)) .crm-account-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 14px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: #f0f5f7;
}

:where(:root:has(body.crm-shell)) .crm-account-caption {
  color: #617586;
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

:where(:root:has(body.crm-shell)) .crm-account-summary strong {
  font-size: .95rem;
  font-weight: 600;
  overflow-wrap: anywhere;
  max-width: 100%;
}

:where(:root:has(body.crm-shell)) .crm-role-badge {
  padding: 3px 9px;
  border-radius: 20px;
  background: #dceeea;
  color: #315e58;
  font-size: .72rem;
  font-weight: 600;
}

:where(:root:has(body.crm-shell)) .crm-header .crm-account-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 9px;
  color: #243b50;
  font-size: .9rem;
  font-weight: 500;
}

:where(:root:has(body.crm-shell)) .crm-account-menu .dropdown-item .bi {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

:where(:root:has(body.crm-shell)) .crm-header .crm-account-menu .dropdown-item:hover,
:where(:root:has(body.crm-shell)) .crm-header .crm-account-menu .dropdown-item:focus {
  background: #edf3f6;
  color: #243b50;
}

:where(:root:has(body.crm-shell)) .crm-account-menu .dropdown-divider {
  margin: 7px 10px;
  border-color: #dbe5eb;
  opacity: 1;
}

:where(:root:has(body.crm-shell)) .crm-header .crm-account-menu .dropdown-item.text-danger {
  color: #b54747 !important;
}

:where(:root:has(body.crm-shell)) .crm-header .crm-account-menu .dropdown-item.text-danger:hover,
:where(:root:has(body.crm-shell)) .crm-header .crm-account-menu .dropdown-item.text-danger:focus {
  background: #fcf0f0;
}


/* =========================================================
   Ticket and Billing Detail CSS
   ========================================================= */
/* Ticket and billing detail pages */
:where(:root:has(body.crm-shell)) .record-page {
  padding-top: 1.6rem;
}

:where(:root:has(body.crm-shell)) .record-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.8rem;
}

:where(:root:has(body.crm-shell)) .record-heading {
  min-width: 0;
}

:where(:root:has(body.crm-shell)) .record-eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: .8rem;
}

:where(:root:has(body.crm-shell)) .record-eyebrow>span:first-child {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .09em;
  color: var(--crm-muted);
}

:where(:root:has(body.crm-shell)) .record-eyebrow>span:first-child i {
  color: var(--crm-accent);
  margin-right: .4rem;
  font-size: 1rem;
}

:where(:root:has(body.crm-shell)) .record-heading h1 {
  font-size: clamp(1.5rem, 2.2vw, 2.2rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -.035em;
  margin: 0 0 .7rem;
  overflow-wrap: anywhere;
}

:where(:root:has(body.crm-shell)) .record-customer {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  color: var(--crm-muted);
  font-size: .95rem;
}

:where(:root:has(body.crm-shell)) .record-customer i {
  color: var(--crm-accent);
}

:where(:root:has(body.crm-shell)) .record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  flex-shrink: 0;
}

:where(:root:has(body.crm-shell)) .record-actions .btn {
  padding: .65rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  border-radius: .45rem;
}

:where(:root:has(body.crm-shell)) .record-actions i {
  margin-right: .35rem;
}

:where(:root:has(body.crm-shell)) .record-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 1.4rem;
  align-items: start;
}

:where(:root:has(body.crm-shell)) .record-main,
:where(:root:has(body.crm-shell)) .record-aside {
  display: grid;
  gap: 1.2rem;
  min-width: 0;
}

:where(:root:has(body.crm-shell)) .record-panel {
  background: #fff;
  border: 1px solid var(--crm-border);
  border-radius: .65rem;
  box-shadow: 0 2px 5px rgb(24 43 55 / 3%);
  overflow: hidden;
}

:where(:root:has(body.crm-shell)) .record-panel-heading {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.2rem 1.4rem 0;
}

:where(:root:has(body.crm-shell)) .record-panel-heading h2 {
  margin: 0;
  font-size: .95rem;
  font-weight: 650;
  color: var(--crm-text);
}

:where(:root:has(body.crm-shell)) .record-section-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: .45rem;
  background: #e8f4f4;
  color: #08717d;
}

:where(:root:has(body.crm-shell)) .record-prose {
  padding: 1.1rem 1.4rem 1.5rem;
  color: var(--crm-text);
  line-height: 1.8;
  font-size: .95rem;
  overflow-wrap: anywhere;
}

:where(:root:has(body.crm-shell)) .record-description .record-prose {
  min-height: 0;
}

:where(:root:has(body.crm-shell)) .record-empty {
  color: var(--crm-muted);
  margin: 0;
  font-size: .9rem;
}

:where(:root:has(body.crm-shell)) .record-properties {
  margin: 0;
  padding: .5rem 1.4rem 1.1rem;
}

:where(:root:has(body.crm-shell)) .record-properties>div {
  padding: 1rem 0;
  border-bottom: 1px solid var(--crm-border);
}

:where(:root:has(body.crm-shell)) .record-properties>div:last-child {
  border-bottom: 0;
  padding-bottom: .2rem;
}

:where(:root:has(body.crm-shell)) .record-properties dd {
  margin: 0;
  font-size: .88rem;
  font-weight: 550;
  overflow-wrap: anywhere;
}

:where(:root:has(body.crm-shell)) .record-properties dd>i {
  color: var(--crm-accent);
  margin-right: .25rem;
}

:where(:root:has(body.crm-shell)) .record-secondary {
  display: block;
  margin-top: .3rem;
  font-size: .78rem;
  color: var(--crm-muted);
  font-weight: 400;
}

:where(:root:has(body.crm-shell)) .record-dates dt i {
  margin-right: .35rem;
}

:where(:root:has(body.crm-shell)) .record-dates dd {
  font-size: .8rem;
  font-weight: 400;
}

:where(:root:has(body.crm-shell)) .record-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .7rem;
  border-radius: 50rem;
  font-size: .73rem;
  line-height: 1.2;
  font-weight: 600;
}

:where(:root:has(body.crm-shell)) .record-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

:where(:root:has(body.crm-shell)) .record-page .tone-red {
  background: #fbe5e8;
  color: #a82337;
}

:where(:root:has(body.crm-shell)) .record-page .tone-orange {
  background: #fff0df;
  color: #ad4800;
}

:where(:root:has(body.crm-shell)) .record-page .tone-teal {
  background: #dcf2f2;
  color: #076d77;
}

:where(:root:has(body.crm-shell)) .record-page .tone-purple {
  background: #eee7fc;
  color: #6742a6;
}

:where(:root:has(body.crm-shell)) .record-page .tone-green {
  background: #e1f3e9;
  color: #226844;
}

:where(:root:has(body.crm-shell)) .record-page .tone-neutral {
  background: #edf1f4;
  color: #52616d;
}

:where(:root:has(body.crm-shell)) .record-page a:focus-visible {
  outline: 3px solid #087f8c;
  outline-offset: 4px;
}

@media (max-width: 991.98px) {
  :where(:root:has(body.crm-shell)) .record-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  :where(:root:has(body.crm-shell)) .record-aside {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  :where(:root:has(body.crm-shell)) .record-hero {
    align-items: flex-start;
    gap: 1rem;
  }
}

@media (max-width: 575.98px) {
  :where(:root:has(body.crm-shell)) .record-hero {
    flex-direction: column;
    margin-bottom: 1.2rem;
  }

  :where(:root:has(body.crm-shell)) .record-actions {
    width: 100%;
  }

  :where(:root:has(body.crm-shell)) .record-aside {
    grid-template-columns: minmax(0, 1fr);
  }

  :where(:root:has(body.crm-shell)) .record-panel-heading {
    padding: 1.1rem 1.1rem 0;
  }

  :where(:root:has(body.crm-shell)) .record-properties {
    padding: .4rem 1.1rem 1rem;
  }
}


:where(:root:has(body.crm-shell)) .record-properties dt {
  font-size: .75rem;
  color: var(--crm-muted);
  font-weight: 500;
  margin-bottom: .4rem;
}

/* Full-width, paired ticket and billing detail panels. */
:where(:root:has(body.crm-shell)) .record-hero,
:where(:root:has(body.crm-shell)) .record-layout {
  width: 100%;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
}

:where(:root:has(body.crm-shell)) .record-hero {
  align-items: flex-start;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--crm-border);
}

:where(:root:has(body.crm-shell)) .record-heading h1 {
  font-size: clamp(1.5rem, 2vw, 2rem);
}

:where(:root:has(body.crm-shell)) .record-actions {
  padding-top: .25rem;
}

:where(:root:has(body.crm-shell)) .record-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.5rem;
}

:where(:root:has(body.crm-shell)) .record-main,
:where(:root:has(body.crm-shell)) .record-aside {
  gap: 1.15rem;
  align-content: start;
}

:where(:root:has(body.crm-shell)) .record-narrative .record-panel-heading {
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--crm-border);
}

:where(:root:has(body.crm-shell)) .record-narrative .record-prose {
  padding: 1.25rem 1.35rem;
  font-size: .95rem;
  line-height: 1.75;
}

:where(:root:has(body.crm-shell)) .record-narrative .record-prose>p {
  margin-bottom: 0;
}

:where(:root:has(body.crm-shell)) .record-facts .record-panel-heading {
  padding: 1.25rem 1.3rem .5rem;
}

:where(:root:has(body.crm-shell)) .record-properties {
  padding: 0 1.3rem .8rem;
}

:where(:root:has(body.crm-shell)) .record-properties>div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  align-items: baseline;
  gap: .7rem;
  padding: .95rem 0;
}

:where(:root:has(body.crm-shell)) .record-properties dt {
  margin: 0;
}

:where(:root:has(body.crm-shell)) .record-properties dd {
  font-size: .83rem;
  line-height: 1.5;
}

:where(:root:has(body.crm-shell)) .record-properties>div:last-child {
  padding-bottom: .6rem;
}

:where(:root:has(body.crm-shell)) .record-properties .record-hours-inline {
  font-size: .95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

:where(:root:has(body.crm-shell)) .record-hours-inline span {
  font-size: .78rem;
  font-weight: 400;
  color: var(--crm-muted);
}

:where(:root:has(body.crm-shell)) .record-secondary {
  font-size: .73rem;
}

:where(:root:has(body.crm-shell)) .record-dates>div {
  display: block;
}

:where(:root:has(body.crm-shell)) .record-dates dt {
  margin-bottom: .4rem;
}

:where(:root:has(body.crm-shell)) .record-dates dd {
  font-size: .8rem;
}

@media (max-width: 991.98px) {
  :where(:root:has(body.crm-shell)) .record-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  :where(:root:has(body.crm-shell)) .record-aside {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  :where(:root:has(body.crm-shell)) .record-hero {
    gap: 1rem;
    padding-bottom: 1.2rem;
    margin-bottom: 1.2rem;
  }

  :where(:root:has(body.crm-shell)) .record-aside {
    grid-template-columns: minmax(0, 1fr);
  }

  :where(:root:has(body.crm-shell)) .record-narrative .record-panel-heading {
    padding: 1rem 1.1rem;
  }

  :where(:root:has(body.crm-shell)) .record-narrative .record-prose {
    padding: 1.1rem;
  }
}

/* Equal column widths and content-sized, equal-height pairs. */
:where(:root:has(body.crm-shell)) .record-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 1.25rem;
}

:where(:root:has(body.crm-shell)) .record-layout>.record-panel {
  min-width: 0;
}

@media (max-width: 767.98px) {
  :where(:root:has(body.crm-shell)) .record-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}


:where(:root:has(body.crm-shell)) .record-page,
:where(:root:has(body.crm-shell)) .edit-billing-page {
  --crm-text: #000;
  --crm-muted: #6c757d;
  --crm-border: #dee2e6;
  --crm-accent: #31486f;
}

:where(:root:has(body.crm-shell)) .record-page .tone-red {
  background: #dc3545;
  color: white;
}

:where(:root:has(body.crm-shell)) .record-page .tone-orange {
  background: #ffc107;
  color: #000;
}

:where(:root:has(body.crm-shell)) .record-page .tone-teal {
  background: #0dcaf0;
  color: #000;
}

:where(:root:has(body.crm-shell)) .record-page .tone-purple {
  background: #6f42c1;
  color: white;
}

:where(:root:has(body.crm-shell)) .record-page .tone-green {
  background: #198754;
  color: white;
}

:where(:root:has(body.crm-shell)) .record-page .tone-neutral {
  background: #6c757d;
  color: white;
}

:where(:root:has(body.crm-shell)) .record-page .record-section-icon {
  background: #f8f9fa;
  color: #31486f;
}

:where(:root:has(body.crm-shell)) .record-page .invoice-entry {
  width: 350px;
  max-width: 100%;
}

:where(:root:has(body.crm-shell)) .record-page .invoice-entry>summary {
  display: block;
  width: max-content;
  margin-left: auto;
  list-style: none;
}

:where(:root:has(body.crm-shell)) .record-page .invoice-entry>summary::-webkit-details-marker {
  display: none;
}

:where(:root:has(body.crm-shell)) .record-page .invoice-entry-form {
  margin-top: .65rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: .5rem;
}

:where(:root:has(body.crm-shell)) .record-page .invoice-entry-buttons {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .85rem;
}

:where(:root:has(body.crm-shell)) .record-page .invoice-entry-buttons .btn {
  padding: .5rem .65rem;
  font-size: .78rem;
}

:where(:root:has(body.crm-shell)) .edit-billing-page .editor-form {
  max-width: 720px;
}

:where(:root:has(body.crm-shell)) .record-page a:focus-visible,
:where(:root:has(body.crm-shell)) .record-page summary:focus-visible {
  outline-color: #0d6efd;
}

@media(min-width:1200px) {

  :where(:root:has(body.crm-shell)) main.record-page,
  :where(:root:has(body.crm-shell)) main.edit-billing-page {
    margin-left: var(--side-w) !important;
    width: calc(100% - var(--side-w)) !important;
    max-width: calc(100% - var(--side-w));
  }
}

@media(max-width:767.98px) {
  :where(:root:has(body.crm-shell)) .record-page .invoice-entry {
    width: 100%;
  }

  :where(:root:has(body.crm-shell)) .record-page .invoice-entry>summary {
    margin-left: 0;
  }
}

:where(:root:has(body.crm-shell)) .record-page {
  --crm-text: #243b50;
  --crm-muted: #617586;
  --crm-border: #dfe6eb;
  --crm-accent: #365466;
}

/* Compact billing details without restricting longer records. */
:where(:root:has(body.crm-shell)) .billing-detail-page .record-heading {
  flex: 1;
}

:where(:root:has(body.crm-shell)) .billing-detail-page .record-customer-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

:where(:root:has(body.crm-shell)) .billing-detail-page .record-hero {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

:where(:root:has(body.crm-shell)) .billing-detail-page .record-heading h1 {
  margin-bottom: .5rem;
}

:where(:root:has(body.crm-shell)) .billing-detail-page .record-layout {
  gap: 1rem;
}

:where(:root:has(body.crm-shell)) .billing-detail-page .record-properties>div {
  padding: .6rem 0;
}

:where(:root:has(body.crm-shell)) .billing-detail-page .record-facts .record-panel-heading {
  padding-top: 1rem;
}

:where(:root:has(body.crm-shell)) .billing-detail-page .record-narrative .record-panel-heading {
  padding-top: .8rem;
  padding-bottom: .8rem;
}

:where(:root:has(body.crm-shell)) .billing-detail-page .record-narrative .record-prose {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

:where(:root:has(body.crm-shell)) body.crm-shell:has(.billing-detail-page) {
  padding-bottom: calc(var(--shell-footer-h) + 12px);
}

:where(:root:has(body.crm-shell)) .crm-shell main.billing-detail-page {
  padding-bottom: 12px !important;
}

@media(max-width:575.98px) {
  :where(:root:has(body.crm-shell)) body.crm-shell:has(.billing-detail-page) {
    padding-bottom: 72px;
  }

  :where(:root:has(body.crm-shell)) .billing-detail-page .record-heading {
    width: 100%;
  }
}

/* Ticket header: customer and status below the title, actions aligned below. */
:where(:root:has(body.crm-shell)) .ticket-detail-page .record-heading {
  flex: 1;
}

:where(:root:has(body.crm-shell)) .ticket-detail-page .record-customer-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

:where(:root:has(body.crm-shell)) .ticket-detail-page .record-actions {
  align-self: flex-end;
  padding-top: 0;
}

:where(:root:has(body.crm-shell)) .ticket-detail-page .record-hero {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

:where(:root:has(body.crm-shell)) .ticket-detail-page .record-heading h1 {
  margin-bottom: .5rem;
}

@media(max-width:575.98px) {
  :where(:root:has(body.crm-shell)) .ticket-detail-page .record-heading {
    width: 100%;
  }
}

/* Invoice popover stays outside document flow, without shifting the record. */
:where(:root:has(body.crm-shell)) .record-page .record-actions {
  position: relative;
  z-index: 10;
}

:where(:root:has(body.crm-shell)) .record-page .invoice-entry {
  position: relative;
  width: auto;
}

:where(:root:has(body.crm-shell)) .record-page .invoice-entry-form {
  position: absolute;
  top: 100%;
  right: 0;
  width: 350px;
  max-width: calc(100vw - 32px);
  z-index: 20;
  box-shadow: 0 12px 32px rgba(24, 43, 61, .18);
  border-radius: 12px;
}

:where(:root:has(body.crm-shell)) .record-page .invoice-entry[open]>.invoice-entry-form {
  animation: invoice-popover-in 160ms ease-out;
}

@keyframes invoice-popover-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media(max-width:767.98px) {
  :where(:root:has(body.crm-shell)) .record-page .invoice-entry-form {
    right: auto;
    left: 0;
  }
}

@media(prefers-reduced-motion:reduce) {
  :where(:root:has(body.crm-shell)) .record-page .invoice-entry[open]>.invoice-entry-form {
    animation: none;
  }
}


/* =========================================================
   Content, Forms and Tasks CSS
   ========================================================= */
/* Content palette only: the established header, sidebar and footer are untouched. */
:where(:root:has(body.crm-shell)) .crm-shell main {
  --content-ink: #263d4c;
  --content-muted: #607382;
  --content-line: #cbd7df;
  --content-action: #326b75;
  --bs-body-color: var(--content-ink);
  --bs-secondary-color: var(--content-muted);
  --bs-border-color: var(--content-line);
  color: var(--content-ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(h1, h2, h3, h4, h5, h6, .card h2, .card-header h5, .card-header h6) {
  color: var(--content-ink);
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(h1, h2, h3, h4, h5, h6) {
  font-weight: 600;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(.text-muted, .text-secondary) {
  color: var(--content-muted) !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main .text-primary {
  color: var(--content-action) !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main .text-success {
  color: #26734e !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main .text-warning {
  color: #a36515 !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main .text-danger {
  color: #b2454e !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main .text-info {
  color: #287788 !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main a:not(.btn):not(.badge):not(.nav-link) {
  color: #326b75;
}

:where(:root:has(body.crm-shell)) .crm-shell main .card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 0 0 1px #d1dce4, 0 3px 10px #243b5010 !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main .card-header {
  background: #fff !important;
  color: var(--content-ink) !important;
  border-bottom: 1px solid var(--content-line);
}

:where(:root:has(body.crm-shell)) .crm-shell main .card-header:first-child {
  border-radius: 12px 12px 0 0;
}

:where(:root:has(body.crm-shell)) .crm-shell main .card-header :is(h5, h6) {
  color: var(--content-ink) !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main .table {
  --bs-table-color: var(--content-ink);
  --bs-table-bg: #fff;
  --bs-table-border-color: #d5dfe6;
  --bs-table-striped-bg: #fff;
  --bs-table-hover-bg: #f1f6f7;
  --bs-table-hover-color: var(--content-ink);
}

:where(:root:has(body.crm-shell)) .crm-shell main .table thead th {
  color: #334d5e !important;
  border-color: #cbd7df;
  font-weight: 600;
}

:where(:root:has(body.crm-shell)) .crm-shell main .table :is(td, th) {
  vertical-align: middle;
}

:where(:root:has(body.crm-shell)) .crm-shell main .list-group-item {
  background: #fff;
  color: var(--content-ink);
  border-color: var(--content-line);
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(.form-control, .form-select) {
  color: var(--content-ink);
  background-color: #fff;
  border-color: #bdcdd6;
  border-radius: 8px;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(.form-control, .form-select):focus {
  border-color: #4e8992;
  box-shadow: 0 0 0 .2rem #326b751f;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(.form-control, .form-select):disabled {
  background: #edf2f5;
  color: #617382;
}

:where(:root:has(body.crm-shell)) .crm-shell main .form-control::placeholder {
  color: #71828e;
}

:where(:root:has(body.crm-shell)) .crm-shell main .form-label {
  color: #425b6a;
  font-weight: 600;
}

:where(:root:has(body.crm-shell)) .crm-shell main .input-group-text {
  background: #edf2f5;
  border-color: #bdcdd6;
  color: #536c7b;
}

:where(:root:has(body.crm-shell)) .crm-shell main .form-check-input:checked {
  background-color: #326b75;
  border-color: #326b75;
}

:where(:root:has(body.crm-shell)) .crm-shell main .btn {
  border-radius: 8px;
  font-weight: 500;
}

:where(:root:has(body.crm-shell)) .crm-shell main .btn-primary {
  --bs-btn-bg: #326b75;
  --bs-btn-border-color: #326b75;
  --bs-btn-hover-bg: #285963;
  --bs-btn-hover-border-color: #285963;
  --bs-btn-active-bg: #234f58;
  --bs-btn-active-border-color: #234f58;
  --bs-btn-disabled-bg: #326b75;
  --bs-btn-disabled-border-color: #326b75;
  --bs-btn-focus-shadow-rgb: 50, 107, 117;
}

:where(:root:has(body.crm-shell)) .crm-shell main .btn-outline-primary {
  --bs-btn-color: #326b75;
  --bs-btn-border-color: #326b75;
  --bs-btn-hover-bg: #326b75;
  --bs-btn-hover-border-color: #326b75;
  --bs-btn-active-bg: #285963;
  --bs-btn-active-border-color: #285963;
  --bs-btn-focus-shadow-rgb: 50, 107, 117;
}

:where(:root:has(body.crm-shell)) .crm-shell main .btn-success {
  --bs-btn-bg: #327653;
  --bs-btn-border-color: #327653;
  --bs-btn-hover-bg: #275f43;
  --bs-btn-hover-border-color: #275f43;
  --bs-btn-active-bg: #214f38;
  --bs-btn-active-border-color: #214f38;
}

:where(:root:has(body.crm-shell)) .crm-shell main .btn-danger {
  --bs-btn-bg: #b44850;
  --bs-btn-border-color: #b44850;
  --bs-btn-hover-bg: #983942;
  --bs-btn-hover-border-color: #983942;
  --bs-btn-active-bg: #85323a;
  --bs-btn-active-border-color: #85323a;
}

:where(:root:has(body.crm-shell)) .crm-shell main .btn-outline-danger {
  --bs-btn-color: #ac3f49;
  --bs-btn-border-color: #c67e84;
  --bs-btn-hover-bg: #ac3f49;
  --bs-btn-hover-border-color: #ac3f49;
  --bs-btn-active-bg: #983942;
  --bs-btn-active-border-color: #983942;
}

:where(:root:has(body.crm-shell)) .crm-shell main .btn-outline-success {
  --bs-btn-color: #2b704b;
  --bs-btn-border-color: #659d7b;
  --bs-btn-hover-bg: #2b704b;
  --bs-btn-hover-border-color: #2b704b;
  --bs-btn-active-bg: #245f40;
  --bs-btn-active-border-color: #245f40;
}

:where(:root:has(body.crm-shell)) .crm-shell main .btn-secondary {
  --bs-btn-bg: #647783;
  --bs-btn-border-color: #647783;
  --bs-btn-hover-bg: #506470;
  --bs-btn-hover-border-color: #506470;
  --bs-btn-active-bg: #425561;
  --bs-btn-active-border-color: #425561;
}

:where(:root:has(body.crm-shell)) .crm-shell main .btn-outline-secondary {
  --bs-btn-color: #566e7d;
  --bs-btn-border-color: #a3b4bf;
  --bs-btn-hover-bg: #eaf0f3;
  --bs-btn-hover-color: #263d4c;
  --bs-btn-hover-border-color: #829aa9;
  --bs-btn-active-bg: #dae5eb;
  --bs-btn-active-color: #263d4c;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(.badge, .record-pill) {
  font-weight: 600;
  border-radius: 6px;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(.badge.bg-danger, .record-pill.tone-red) {
  background: #f9e7e9 !important;
  color: #a33441 !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(.badge.bg-warning, .record-pill.tone-orange) {
  background: #fff0dc !important;
  color: #885010 !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(.badge.bg-info, .record-pill.tone-teal) {
  background: #e0f1f5 !important;
  color: #226677 !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(.badge.bg-success, .record-pill.tone-green) {
  background: #e2f1e8 !important;
  color: #256443 !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(.badge.bg-purple, .badge.status-waiting, .record-pill.tone-purple) {
  background: #eee8f7 !important;
  color: #68468f !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(.badge.bg-primary) {
  background: #e3edf5 !important;
  color: #375d7b !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(.badge.bg-secondary, .badge.bg-dark, .record-pill.tone-neutral) {
  background: #dee6ed !important;
  color: #405969 !important;
}

:where(:root:has(body.crm-shell)) .crm-shell main .alert-success {
  background: #edf7f0;
  border-color: #c9e3d2;
  color: #2b6442;
}

:where(:root:has(body.crm-shell)) .crm-shell main .alert-warning {
  background: #fff5e6;
  border-color: #edd5ac;
  color: #81551f;
}

:where(:root:has(body.crm-shell)) .crm-shell main .alert-danger {
  background: #fbeef0;
  border-color: #edccd1;
  color: #933843;
}

:where(:root:has(body.crm-shell)) .crm-shell main .alert-info {
  background: #edf5f8;
  border-color: #cddfe8;
  color: #365f73;
}

:where(:root:has(body.crm-shell)) .crm-shell main .record-panel {
  border-color: var(--content-line);
  border-radius: 12px;
}

:where(:root:has(body.crm-shell)) .crm-shell main .record-section-icon {
  background: #e9f2f2;
  color: #326b75;
}

:where(:root:has(body.crm-shell)) .crm-shell main .record-panel-heading {
  background: #fff;
}

:where(:root:has(body.crm-shell)) .crm-shell main.record-page {
  --crm-text: var(--content-ink);
  --crm-muted: var(--content-muted);
  --crm-border: var(--content-line);
  --crm-accent: var(--content-action);
}

:where(:root:has(body.crm-shell)) .crm-shell main .page-link {
  color: #326b75;
  border-color: #dce5ea;
}

:where(:root:has(body.crm-shell)) .crm-shell main .active>.page-link {
  background: #326b75;
  border-color: #326b75;
  color: #fff;
}

:where(:root:has(body.crm-shell)) .crm-shell main .nav-tabs .nav-link {
  color: #5a7281;
}

:where(:root:has(body.crm-shell)) .crm-shell main .nav-tabs .nav-link.active {
  color: #285963;
  border-color: #dce5ea #dce5ea #fff;
}

:where(:root:has(body.crm-shell)) .crm-shell main :is(a, button, summary):focus-visible {
  outline: 2px solid #326b75;
  outline-offset: 3px;
}

/* Subtle structural contrast, without adding more status colors. */
:where(:root:has(body.crm-shell)) .crm-shell main .record-panel {
  box-shadow: 0 2px 8px #243b5010;
}

:where(:root:has(body.crm-shell)) .crm-shell main .badge {
  box-shadow: inset 0 0 0 1px #243b5010;
}

:where(:root:has(body.crm-shell)) .crm-shell main #meeting-join-panel {
  background: #edf2f6;
}

:where(:root:has(body.crm-shell)) .crm-shell main #meeting-empty {
  background: #fff;
}

:where(:root:has(body.crm-shell)) .crm-shell main #meeting-empty>.bi {
  color: #5b7488 !important;
}

/* Compact admin pages, keeping the shared white title rows. */
:where(:root:has(body.crm-shell)) .admin-page-heading {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #cbd7df;
}

:where(:root:has(body.crm-shell)) .admin-page-heading p {
  font-size: .85rem;
}

:where(:root:has(body.crm-shell)) .admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px;
}

:where(:root:has(body.crm-shell)) .admin-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

:where(:root:has(body.crm-shell)) .admin-section-title>.bi {
  color: #617b8d;
  font-size: 1.1rem;
}

:where(:root:has(body.crm-shell)) .admin-section-title h5 {
  font-size: 1rem;
}

:where(:root:has(body.crm-shell)) .admin-page .table {
  margin-bottom: 0;
}

:where(:root:has(body.crm-shell)) .admin-page .table td {
  padding-top: 11px;
  padding-bottom: 11px;
}

:where(:root:has(body.crm-shell)) .admin-page .table td:last-child {
  white-space: nowrap;
}

:where(:root:has(body.crm-shell)) .admin-page .table th {
  white-space: nowrap;
}

:where(:root:has(body.crm-shell)) .admin-search {
  max-width: 300px;
}

@media(max-width:575.98px) {
  :where(:root:has(body.crm-shell)) .admin-search {
    max-width: none;
    width: 100%;
  }
}

/* Wrapping status filters retain a clear selected state on smaller screens. */
:where(:root:has(body.crm-shell)) .ticket-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

:where(:root:has(body.crm-shell)) .crm-shell .tickets-page .ticket-filters .btn {
  font-size: .82rem;
  padding: 7px 12px;
  border-radius: 8px;
  background: #fff;
}

:where(:root:has(body.crm-shell)) .crm-shell .tickets-page .ticket-filters .btn.active {
  background: #326b75;
  color: #fff;
  border-color: #326b75;
}

:where(:root:has(body.crm-shell)) .crm-shell .tickets-page .ticket-filters .btn:hover:not(.active) {
  background: #eaf0f3;
}

:where(:root:has(body.crm-shell)) .tickets-page #tickets-table td:nth-child(2) {
  min-width: 180px;
}

:where(:root:has(body.crm-shell)) .tickets-page #tickets-table td:first-child {
  font-weight: 500;
}

:where(:root:has(body.crm-shell)) .tickets-page #tickets-table td:nth-child(6) {
  white-space: nowrap;
  color: #607382;
  font-size: .82rem;
}

:where(:root:has(body.crm-shell)) .customers-page #customerSearch {
  border-radius: 8px !important;
  box-shadow: none;
}

:where(:root:has(body.crm-shell)) .customers-page #customerTable td:first-child {
  font-weight: 500;
}

:where(:root:has(body.crm-shell)) .customers-page #customerTable :is(th:last-child, td:last-child) {
  text-align: right;
}

:where(:root:has(body.crm-shell)) .customers-page #customerTable td:nth-child(2) {
  color: #607382;
  font-size: .85rem;
}

:where(:root:has(body.crm-shell)) .erate-page #results .table td:first-child {
  font-weight: 500;
}

:where(:root:has(body.crm-shell)) .erate-page #results .table td:last-child {
  white-space: normal;
}

:where(:root:has(body.crm-shell)) .crm-shell .tasks-page .ticket-filters .btn {
  font-size: .82rem;
  padding: 7px 12px;
  border-radius: 8px;
  background: #fff;
}

:where(:root:has(body.crm-shell)) .crm-shell .tasks-page .ticket-filters .btn.active {
  background: #326b75;
  color: #fff;
  border-color: #326b75;
}

:where(:root:has(body.crm-shell)) .crm-shell .tasks-page .ticket-filters .btn:hover:not(.active) {
  background: #eaf0f3;
}

:where(:root:has(body.crm-shell)) .tasks-page .table td:first-child {
  font-weight: 500;
  min-width: 180px;
}

:where(:root:has(body.crm-shell)) .hours-page .table td:nth-child(3) {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

:where(:root:has(body.crm-shell)) .hours-page .table td:nth-child(4) {
  white-space: normal;
}

/* Focused editors: comfortable line lengths, consistent action rows. */
:where(:root:has(body.crm-shell)) .editor-page {
  --editor-width: 100%;
}

:where(:root:has(body.crm-shell)) .editor-page.editor-compact {
  --editor-width: 100%;
}

:where(:root:has(body.crm-shell)) .editor-page> :is(form, div, h1, h2) {
  max-width: var(--editor-width);
  margin-left: auto;
  margin-right: auto;
}

:where(:root:has(body.crm-shell)) .editor-page>h1 {
  padding-bottom: 16px;
  border-bottom: 1px solid #cbd7df;
}

:where(:root:has(body.crm-shell)) .editor-page form.card {
  padding: 24px !important;
}

:where(:root:has(body.crm-shell)) .editor-page form .text-end {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid #e1e8ed;
  padding-top: 18px;
  margin-top: 8px;
}

:where(:root:has(body.crm-shell)) .editor-page textarea {
  min-height: 110px;
  resize: vertical;
}

:where(:root:has(body.crm-shell)) .editor-page .form-control[readonly] {
  background: #f1f5f7;
}

:where(:root:has(body.crm-shell)) .customer-entry {
  position: relative;
  z-index: 20;
}

:where(:root:has(body.crm-shell)) .customer-entry>summary {
  list-style: none;
}

:where(:root:has(body.crm-shell)) .customer-entry>summary::-webkit-details-marker {
  display: none;
}

:where(:root:has(body.crm-shell)) .customer-entry-form {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 10px;
  width: 350px;
  max-width: calc(100vw - 32px);
  padding: 20px;
  background: white;
  border: 1px solid #cbd7df;
  border-radius: 12px;
  box-shadow: 0 12px 32px #182b3d2e;
}

:where(:root:has(body.crm-shell)) .customer-entry[open] .customer-entry-form {
  animation: customer-pop-in 160ms ease-out;
}

@keyframes customer-pop-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media(max-width:575.98px) {
  :where(:root:has(body.crm-shell)) .customer-entry-form {
    left: 0;
    right: auto;
  }

  :where(:root:has(body.crm-shell)) .editor-page form.card {
    padding: 18px !important;
  }
}

@media(prefers-reduced-motion:reduce) {
  :where(:root:has(body.crm-shell)) .customer-entry[open] .customer-entry-form {
    animation: none;
  }
}


/* =========================================================
   Dashboard CSS
   ========================================================= */
:where(:root:has(body.crm-shell)) .dashboard-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
}

:where(:root:has(body.crm-shell)) .dashboard-kicker {
  color: #617b8d;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

:where(:root:has(body.crm-shell)) .dashboard-heading p {
  font-size: .86rem;
}

:where(:root:has(body.crm-shell)) .dashboard-week {
  margin-left: 12px;
  color: #425b6a;
  font-weight: 500;
}

:where(:root:has(body.crm-shell)) .dashboard-shortcuts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

:where(:root:has(body.crm-shell)) .dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

:where(:root:has(body.crm-shell)) .crm-shell main .dashboard-metric {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  text-decoration: none;
  color: #263d4c;
  transition: box-shadow .15s ease;
}

:where(:root:has(body.crm-shell)) .dashboard-metric h2 {
  font-size: .83rem;
  font-weight: 500 !important;
  margin: 0 0 7px;
}

:where(:root:has(body.crm-shell)) .dashboard-metric strong {
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

:where(:root:has(body.crm-shell)) .dashboard-metric p {
  margin: 6px 0 0;
  font-size: .72rem;
  color: #607382;
}

:where(:root:has(body.crm-shell)) .dashboard-metric-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 1.4rem;
}

:where(:root:has(body.crm-shell)) .dashboard-tone-red .dashboard-metric-icon {
  background: #f9e7e9;
  color: #a33441;
}

:where(:root:has(body.crm-shell)) .dashboard-tone-amber .dashboard-metric-icon {
  background: #fff0dc;
  color: #885010;
}

:where(:root:has(body.crm-shell)) .dashboard-tone-blue .dashboard-metric-icon {
  background: #e0f1f5;
  color: #226677;
}

:where(:root:has(body.crm-shell)) .dashboard-tone-purple .dashboard-metric-icon {
  background: #eee8f7;
  color: #68468f;
}

:where(:root:has(body.crm-shell)) .crm-shell main a.dashboard-metric:hover {
  box-shadow: 0 0 0 1px #9db5c3, 0 5px 14px #243b5012 !important;
}

:where(:root:has(body.crm-shell)) .dashboard-pulse {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 2px 18px;
  font-size: .8rem;
  color: #607382;
}

:where(:root:has(body.crm-shell)) .dashboard-pulse strong {
  color: #334d5e;
}

:where(:root:has(body.crm-shell)) .dashboard-attention {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

:where(:root:has(body.crm-shell)) .dashboard-attention .bi {
  margin-right: 5px;
  color: #718897;
}

:where(:root:has(body.crm-shell)) .dashboard-workspace {
  display: grid;
  grid-template-columns: minmax(0, 2.5fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: stretch;
}

:where(:root:has(body.crm-shell)) .dashboard-workspace>.card {
  min-width: 0;
  overflow: hidden;
}

:where(:root:has(body.crm-shell)) .dashboard-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
}

:where(:root:has(body.crm-shell)) .dashboard-section-heading h2 {
  font-size: 1rem;
  margin: 0;
}

:where(:root:has(body.crm-shell)) .dashboard-section-heading h2 .bi {
  color: #617b8d;
}

:where(:root:has(body.crm-shell)) .dashboard-section-heading p {
  color: #607382;
  font-size: .72rem;
  margin: 5px 0 0;
}

:where(:root:has(body.crm-shell)) .dashboard-calendar-body {
  flex: 1;
  min-height: 480px;
}

:where(:root:has(body.crm-shell)) .dashboard-task-list {
  flex: 1;
}

:where(:root:has(body.crm-shell)) .crm-shell main .dashboard-task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 18px;
  text-decoration: none;
  color: #263d4c;
  border-bottom: 1px solid #e1e8ed;
}

:where(:root:has(body.crm-shell)) .dashboard-task>div {
  flex: 1;
  min-width: 0;
}

:where(:root:has(body.crm-shell)) .dashboard-task strong {
  display: block;
  font-size: .86rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

:where(:root:has(body.crm-shell)) .dashboard-task div span {
  display: block;
  margin-top: 5px;
  font-size: .75rem;
  color: #607382;
}

:where(:root:has(body.crm-shell)) .dashboard-task>.bi {
  font-size: .7rem;
  color: #8498a4;
}

:where(:root:has(body.crm-shell)) .dashboard-task-marker {
  color: #74929d;
}

:where(:root:has(body.crm-shell)) .dashboard-task:hover {
  background: #f5f8fa;
}

:where(:root:has(body.crm-shell)) .dashboard-task-footer {
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

:where(:root:has(body.crm-shell)) .dashboard-clear {
  text-align: center;
  padding: 50px 24px;
}

:where(:root:has(body.crm-shell)) .dashboard-clear>.bi {
  color: #68977d;
  font-size: 2.2rem;
}

:where(:root:has(body.crm-shell)) .dashboard-clear h3 {
  font-size: 1rem;
  margin-top: 16px;
}

:where(:root:has(body.crm-shell)) .dashboard-clear p {
  color: #607382;
  font-size: .85rem;
}

@media(max-width:1399.98px) {
  :where(:root:has(body.crm-shell)) .dashboard-metric {
    padding: 16px !important;
  }

  :where(:root:has(body.crm-shell)) .dashboard-metric-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 1.2rem;
  }
}

@media(max-width:991.98px) {
  :where(:root:has(body.crm-shell)) .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  :where(:root:has(body.crm-shell)) .dashboard-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media(max-width:575.98px) {
  :where(:root:has(body.crm-shell)) .dashboard-metrics {
    gap: 10px;
  }

  :where(:root:has(body.crm-shell)) .dashboard-metric-icon {
    display: none;
  }

  :where(:root:has(body.crm-shell)) .dashboard-week {
    display: block;
    margin: 4px 0 0;
  }

  :where(:root:has(body.crm-shell)) .dashboard-calendar-body {
    overflow-x: auto;
  }

  :where(:root:has(body.crm-shell)) .dashboard-attention {
    gap: 12px;
  }
}

@media(prefers-reduced-motion:reduce) {
  :where(:root:has(body.crm-shell)) .dashboard-metric {
    transition: none !important;
  }
}

/* =========================================================
   Google Calendar CSS
   ========================================================= */
/* Dashboard calendar: scoped to keep the existing CRM shell untouched. */
:where(:root:has(body.crm-shell)) #crm-calendar {
  padding: 16px;
}

:where(:root:has(body.crm-shell)) .gc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

:where(:root:has(body.crm-shell)) .gc-caption {
  font-size: .75rem;
  color: #607382;
  margin: 12px 0;
}

:where(:root:has(body.crm-shell)) #gc-message {
  font-size: .85rem;
  color: #425b6a;
  overflow-wrap: anywhere;
}

:where(:root:has(body.crm-shell)) .gc-days {
  display: block;
  height: clamp(360px, 56vh, 600px);
  overflow: auto;
  scrollbar-width: thin;
}

:where(:root:has(body.crm-shell)) .gc-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  min-height: 100%;
  align-items: stretch;
}

:where(:root:has(body.crm-shell)) .gc-day {
  border: 1px solid #dce5eb;
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  min-width: 0;
  min-height: min-content;
  overflow: visible;
  box-sizing: border-box;
}

:where(:root:has(body.crm-shell)) .gc-day h3 {
  position: sticky;
  top: -8px;
  z-index: 1;
  background: inherit;
  padding-top: 8px;
  font-size: .8rem;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e1e8ed;
}

:where(:root:has(body.crm-shell)) .gc-day.gc-current {
  border-color: #6b929b;
  background: #f5fafb;
}

:where(:root:has(body.crm-shell)) .gc-empty {
  font-size: .72rem;
  color: #768895;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event {
  display: block;
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #c7dce0;
  border-radius: 7px;
  background: #eaf3f4;
  color: #284d57;
  padding: 7px;
  margin: 0 0 8px;
  text-align: left;
  overflow-wrap: anywhere;
}

:where(:root:has(body.crm-shell)) .gc-event strong,
:where(:root:has(body.crm-shell)) .gc-event span {
  display: block;
  font-size: .73rem;
}

:where(:root:has(body.crm-shell)) .gc-event span {
  margin-top: 4px;
  font-size: .68rem;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event:hover {
  background: #dcecef;
}

:where(:root:has(body.crm-shell)) #gc-dialog {
  border: 1px solid #ccdbe2;
  border-radius: 16px;
  padding: 24px;
  width: min(560px, calc(100vw - 24px));
  max-height: 90vh;
  overflow: auto;
  color: #263d4c;
  box-shadow: 0 20px 70px #142e4350;
}

:where(:root:has(body.crm-shell)) #gc-dialog::backdrop {
  background: #142e4370;
}

:where(:root:has(body.crm-shell)) .gc-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media(max-width:1199px) {
  :where(:root:has(body.crm-shell)) .gc-week-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  :where(:root:has(body.crm-shell)) .gc-day h3 {
    position: static;
  }
}

@media(max-width:575px) {

  :where(:root:has(body.crm-shell)) .gc-week-grid,
  :where(:root:has(body.crm-shell)) .gc-dates {
    grid-template-columns: 1fr;
  }

  :where(:root:has(body.crm-shell)) .gc-day {
    min-height: 70px;
  }
}

/* Current timed appointment: light highlight with a readable, non-color cue. */
:where(:root:has(body.crm-shell)) #crm-calendar .gc-event.gc-event-now {
  background: #fff8dc;
  border-color: #c6a95f;
  box-shadow: 0 0 0 1px #c6a95f40;
  color: #594819;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event.gc-event-now:hover {
  background: #fff1c2;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-now {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-top: 5px;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-now[hidden] {
  display: none;
}

/* View filters for the combined weekly schedule. */
:where(:root:has(body.crm-shell)) .gc-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
}

:where(:root:has(body.crm-shell)) .gc-filters label {
  display: block;
  font-size: .72rem;
  color: #607382;
  margin-bottom: 4px;
}

:where(:root:has(body.crm-shell)) .gc-filters select {
  min-width: 155px;
  max-width: 100%;
}

:where(:root:has(body.crm-shell)) #gc-person-filter[hidden] {
  display: none;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-location {
  color: #526c76;
  font-size: .65rem;
}

:where(:root:has(body.crm-shell)) #gc-dialog input[readonly],
:where(:root:has(body.crm-shell)) #gc-dialog textarea[readonly] {
  background: #f5f8fa;
}

:where(:root:has(body.crm-shell)) #gc-dialog #gc-save[hidden],
:where(:root:has(body.crm-shell)) #gc-dialog #gc-delete[hidden] {
  display: none;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event-owner {
  font-size: .65rem;
  font-weight: 700;
  color: #526c76;
  margin: 0 0 4px;
}

/* Appointment duration sets height; text never enlarges the block. */
:where(:root:has(body.crm-shell)) #crm-calendar .gc-event {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 2px;
  padding: 5px 6px;
  overflow: hidden;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event strong,
:where(:root:has(body.crm-shell)) #crm-calendar .gc-event span {
  flex-shrink: 0;
  min-width: 0;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event strong {
  font-size: .69rem;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event span {
  font-size: .62rem;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event .gc-event-owner {
  font-size: .6rem;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event .gc-location {
  display: none;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-all-day-event {
  height: 64px;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event .gc-now {
  position: absolute;
  right: 4px;
  bottom: 3px;
  font-size: .55rem;
  background: #fff8dc;
  padding: 1px 3px;
  border-radius: 3px;
}

/* Put secondary controls in the card header; reserve the body for appointments. */
:where(:root:has(body.crm-shell)) .gc-heading-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

:where(:root:has(body.crm-shell)) .gc-header-filters {
  margin: 0;
  gap: 8px;
  align-items: center;
}

:where(:root:has(body.crm-shell)) .gc-header-filters select {
  min-width: 130px;
  max-width: 210px;
}

:where(:root:has(body.crm-shell)) .dashboard-calendar>.dashboard-section-heading {
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
}

:where(:root:has(body.crm-shell)) #crm-calendar {
  padding: 12px;
}

:where(:root:has(body.crm-shell)) .gc-toolbar {
  margin-bottom: 10px;
  gap: 8px;
}

:where(:root:has(body.crm-shell)) #gc-zone[hidden],
:where(:root:has(body.crm-shell)) #gc-message[hidden] {
  display: none;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event {
  margin-bottom: 4px;
  padding: 3px 5px;
  gap: 1px;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event strong {
  font-size: .65rem;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event span {
  font-size: .59rem;
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event .gc-event-owner {
  font-size: .55rem;
}

@media(max-width:575px) {
  :where(:root:has(body.crm-shell)) .gc-heading-controls {
    justify-content: flex-start;
  }

  :where(:root:has(body.crm-shell)) .gc-header-filters select {
    max-width: 170px;
  }
}

/* Readable date/time controls, without the browser's compact time wheel. */
:where(:root:has(body.crm-shell)) #gc-dialog {
  width: min(620px, calc(100vw - 24px));
  color-scheme: light;
}

:where(:root:has(body.crm-shell)) #gc-dialog .gc-date-field {
  min-width: 0;
}

:where(:root:has(body.crm-shell)) #gc-dialog .gc-time-picker {
  border: 0;
  padding: 0;
  margin: 12px 0 0;
  min-width: 0;
}

:where(:root:has(body.crm-shell)) #gc-dialog .gc-time-picker[hidden] {
  display: none;
}

:where(:root:has(body.crm-shell)) #gc-dialog .gc-time-picker legend {
  float: none;
  width: auto;
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: 6px;
}

:where(:root:has(body.crm-shell)) #gc-dialog .gc-time-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 5px;
}

:where(:root:has(body.crm-shell)) #gc-dialog .gc-time-controls select {
  min-width: 0;
  min-height: 40px;
  padding-left: 8px;
  color: #243b50;
  background-color: #fff;
  border: 1px solid #9eb3c1;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
}

:where(:root:has(body.crm-shell)) #gc-dialog .gc-time-controls select:focus {
  border-color: #326b75;
  box-shadow: 0 0 0 3px #326b7526;
}

:where(:root:has(body.crm-shell)) #gc-dialog .gc-time-controls option {
  color: #243b50;
  background: #fff;
}

/* Employee identity stays visible even while the Now highlight is active. */
:where(:root:has(body.crm-shell)) #crm-calendar .gc-event {
  background: var(--employee-bg, #eaf3f4);
  border-color: var(--employee-color, #c7dce0);
  border-left: 3px solid var(--employee-color, #c7dce0);
}

:where(:root:has(body.crm-shell)) #crm-calendar .gc-event.gc-event-now {
  background: #fff8dc;
  border-left-color: var(--employee-color, #c6a95f);
}

/* =========================================================
   Login CSS
   ========================================================= */
:where(:root:has(body.crm-login)) body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background: linear-gradient(145deg, #f6f9fc, #e8eff4);
  color: #263d4c;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

:where(:root:has(body.crm-login)) .login-wrap {
  width: 100%;
  max-width: 420px;
}

:where(:root:has(body.crm-login)) .login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 26px;
  color: #243b50;
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
}

:where(:root:has(body.crm-login)) .login-brand:hover {
  color: #243b50;
}

:where(:root:has(body.crm-login)) .login-brand small {
  margin-left: 5px;
  color: #607382;
  font-size: .7rem;
  letter-spacing: .1em;
}

:where(:root:has(body.crm-login)) .login-brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #243b50;
  color: #a5ded6;
}

:where(:root:has(body.crm-login)) .login-card {
  background: #fff;
  border: 1px solid #d1dce4;
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 12px 36px #243b5010;
}

:where(:root:has(body.crm-login)) .login-heading {
  margin-bottom: 26px;
}

:where(:root:has(body.crm-login)) .login-heading h1 {
  font-size: 1.7rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -.025em;
}

:where(:root:has(body.crm-login)) .login-heading p {
  margin: 0;
  color: #607382;
  font-size: .9rem;
}

:where(:root:has(body.crm-login)) .form-label {
  color: #425b6a;
  font-size: .875rem;
  font-weight: 600;
}

:where(:root:has(body.crm-login)) .form-control {
  min-height: 46px;
  border-color: #bdcdd6;
  border-radius: 8px;
  color: #263d4c;
}

:where(:root:has(body.crm-login)) .form-control:focus {
  border-color: #4e8992;
  box-shadow: 0 0 0 .2rem #326b751f;
}

:where(:root:has(body.crm-login)) .btn-primary {
  min-height: 46px;
  border-radius: 8px;
  font-weight: 600;
  --bs-btn-bg: #326b75;
  --bs-btn-border-color: #326b75;
  --bs-btn-hover-bg: #285963;
  --bs-btn-hover-border-color: #285963;
  --bs-btn-active-bg: #234f58;
  --bs-btn-active-border-color: #234f58;
  --bs-btn-focus-shadow-rgb: 50, 107, 117;
}

:where(:root:has(body.crm-login)) .alert-danger {
  background: #fbeef0;
  border-color: #edccd1;
  color: #933843;
  border-radius: 8px;
  font-size: .875rem;
}

:where(:root:has(body.crm-login)) .login-footer {
  margin-top: 22px;
  text-align: center;
  font-size: .75rem;
  color: #607382;
}

:where(:root:has(body.crm-login)) a:focus-visible {
  outline: 2px solid #326b75;
  outline-offset: 5px;
  border-radius: 6px;
}

@media(max-width:420px) {
  :where(:root:has(body.crm-login)) body {
    padding: 24px 16px;
  }

  :where(:root:has(body.crm-login)) .login-card {
    padding: 26px 22px;
  }
}

/* =========================================================
   Customer Portal CSS
   ========================================================= */
/* Customer portal: shared CRM palette, isolated from staff navigation. */
:where(:root:has(body.customer-portal)) * {
  box-sizing: border-box;
}

:where(:root:has(body.customer-portal)) body {
  margin: 0;
  background: #f6f9ff;
  color: #263d4c;
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}

:where(:root:has(body.customer-portal)) .portal-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px;
}

:where(:root:has(body.customer-portal)) .portal-topbar {
  background: #243b50;
  color: #e3ebf2;
  padding: 16px 24px;
}

:where(:root:has(body.customer-portal)) .portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.2rem;
  font-weight: 600;
}

:where(:root:has(body.customer-portal)) .portal-brand small {
  display: block;
  font-size: .7rem;
  font-weight: 400;
  letter-spacing: .04em;
  color: #adc0d0;
}

:where(:root:has(body.customer-portal)) .portal-brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 12px;
  background: #365466;
  color: #a5ded6;
}

:where(:root:has(body.customer-portal)) .portal-topbar .portal-brand {
  max-width: 1192px;
  margin: auto;
}

:where(:root:has(body.customer-portal)) .portal-welcome {
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid #cbd7df;
}

:where(:root:has(body.customer-portal)) .portal-welcome h1 {
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 6px;
}

:where(:root:has(body.customer-portal)) .portal-welcome p {
  color: #607382;
  margin: 0;
}

:where(:root:has(body.customer-portal)) .portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 24px;
  align-items: start;
}

:where(:root:has(body.customer-portal)) .portal-card {
  min-width: 0;
  padding: 26px;
  background: #fff;
  border: 1px solid #d1dce4;
  border-radius: 14px;
  box-shadow: 0 3px 10px #243b5010;
}

:where(:root:has(body.customer-portal)) .portal-card :is(h1, h2) {
  color: #263d4c;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 8px;
}

:where(:root:has(body.customer-portal)) .portal-card p {
  color: #607382;
  margin: 0 0 22px;
  font-size: .9rem;
}

:where(:root:has(body.customer-portal)) .portal-section-title {
  padding-bottom: 16px;
  border-bottom: 1px solid #dce5ea;
  margin-bottom: 18px !important;
}

:where(:root:has(body.customer-portal)) .form-label {
  display: block;
  font-weight: 600;
  color: #425b6a;
  font-size: .875rem;
  margin-bottom: 6px;
}

:where(:root:has(body.customer-portal)) .form-control,
:where(:root:has(body.customer-portal)) .form-select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  margin-bottom: 18px;
  border: 1px solid #bdcdd6;
  border-radius: 8px;
  background-color: #fff;
  color: #263d4c;
  font: inherit;
}

:where(:root:has(body.customer-portal)) textarea.form-control {
  resize: vertical;
}

:where(:root:has(body.customer-portal)) .form-control:focus,
:where(:root:has(body.customer-portal)) .form-select:focus {
  border-color: #4e8992;
  outline: none;
  box-shadow: 0 0 0 3px #326b751f;
}

:where(:root:has(body.customer-portal)) .btn-submit {
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid #326b75;
  border-radius: 8px;
  background: #326b75;
  color: white;
  font: 600 .95rem "Segoe UI", sans-serif;
  cursor: pointer;
}

:where(:root:has(body.customer-portal)) .btn-submit:hover {
  background: #285963;
  border-color: #285963;
}

:where(:root:has(body.customer-portal)) .btn-submit:focus-visible {
  outline: 2px solid #326b75;
  outline-offset: 3px;
}

:where(:root:has(body.customer-portal)) .portal-error,
:where(:root:has(body.customer-portal)) .portal-success {
  padding: 12px 14px;
  margin-top: 18px;
  border-radius: 8px;
  font-size: .875rem;
  border: 1px solid;
}

:where(:root:has(body.customer-portal)) .portal-error {
  background: #fbeef0;
  border-color: #edccd1;
  color: #933843;
}

:where(:root:has(body.customer-portal)) .portal-success {
  background: #edf7f0;
  border-color: #c9e3d2;
  color: #2b6442;
  transition: opacity 140ms ease-out;
}

:where(:root:has(body.customer-portal)) .portal-empty {
  padding: 24px 8px;
  text-align: center;
}

:where(:root:has(body.customer-portal)) .table-responsive {
  overflow-x: auto;
}

:where(:root:has(body.customer-portal)) .table {
  width: 100%;
  border-collapse: collapse;
  --bs-table-color: #263d4c;
  --bs-table-hover-bg: #f1f6f7;
  --bs-table-hover-color: #263d4c;
  --bs-table-border-color: #d5dfe6;
}

:where(:root:has(body.customer-portal)) .table :is(th, td) {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid #d5dfe6;
  vertical-align: middle;
}

:where(:root:has(body.customer-portal)) .table th {
  color: #334d5e;
  font-weight: 600;
  font-size: .83rem;
}

:where(:root:has(body.customer-portal)) .table td {
  font-size: .85rem;
  overflow-wrap: anywhere;
}

:where(:root:has(body.customer-portal)) .table td:last-child {
  min-width: 140px;
  color: #607382;
  font-size: .78rem;
}

:where(:root:has(body.customer-portal)) .portal-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
  background: #dee6ed;
  color: #405969;
}

:where(:root:has(body.customer-portal)) .status-new {
  background: #f9e7e9;
  color: #a33441;
}

:where(:root:has(body.customer-portal)) .status-progress {
  background: #fff0dc;
  color: #885010;
}

:where(:root:has(body.customer-portal)) .status-scheduled {
  background: #e0f1f5;
  color: #226677;
}

:where(:root:has(body.customer-portal)) .status-waiting {
  background: #eee8f7;
  color: #68468f;
}

:where(:root:has(body.customer-portal)) .portal-footer {
  text-align: center;
  padding: 18px;
  color: #607382;
  font-size: .75rem;
}

:where(:root:has(body.customer-portal)) .portal-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(145deg, #f6f9fc, #e8eff4);
}

:where(:root:has(body.customer-portal)) .portal-login .portal-container {
  max-width: 460px;
  padding: 24px 20px 0;
  margin: 0 auto;
}

:where(:root:has(body.customer-portal)) .portal-login .portal-brand {
  justify-content: center;
  margin-bottom: 26px;
}

:where(:root:has(body.customer-portal)) .portal-login .portal-brand small {
  color: #607382;
}

:where(:root:has(body.customer-portal)) .portal-login .portal-card {
  padding: 32px;
  border-radius: 18px;
}

:where(:root:has(body.customer-portal)) .portal-login h1 {
  font-size: 1.7rem;
}

@media(max-width:991.98px) {
  :where(:root:has(body.customer-portal)) .portal-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media(max-width:575.98px) {
  :where(:root:has(body.customer-portal)) .portal-container {
    padding: 22px 16px;
  }

  :where(:root:has(body.customer-portal)) .portal-card,
  :where(:root:has(body.customer-portal)) .portal-login .portal-card {
    padding: 22px;
  }

  :where(:root:has(body.customer-portal)) .portal-welcome h1 {
    font-size: 1.65rem;
  }
}

@media(prefers-reduced-motion:reduce) {
  :where(:root:has(body.customer-portal)) .portal-success {
    transition: none;
  }
}

/* =========================================================
   Mobile CSS
   ========================================================= */
/* Only phones switch from tabular rows to labeled cards. */
@media (max-width:767.98px) {
  main .phone-table-wrapper {
    overflow: visible;
    min-width: 0;
  }

  main table.phone-cards {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto;
    border: 0;
  }

  main table.phone-cards>thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  main table.phone-cards> :is(tbody, tfoot) {
    display: block;
    width: 100%;
  }

  main table.phone-cards> :is(tbody, tfoot)>tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid #d5e0e7;
    border-radius: 10px;
    background: #fff;
  }

  main table.phone-cards> :is(tbody, tfoot)>tr> :is(td, th) {
    display: block;
    min-width: 0 !important;
    width: auto !important;
    max-width: 100%;
    padding: 0 !important;
    border: 0 !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
    background: transparent !important;
    box-shadow: none !important;
  }

  main table.phone-cards> :is(tbody, tfoot)>tr> :is(td, th)::before {
    content: attr(data-mobile-label);
    display: block;
    font-size: .68rem;
    line-height: 1.4;
    font-weight: 600;
    color: #607382;
    margin-bottom: 4px;
  }

  main table.phone-cards> :is(tbody, tfoot)>tr> :is(td, th)[data-mobile-label=""]::before {
    display: none;
  }

  main table.phone-cards> :is(tbody, tfoot)>tr> :first-child,
  main table.phone-cards .phone-cell-wide {
    grid-column: 1 / -1;
  }

  main table.phone-cards .phone-cell-blank,
  main table.phone-cards> :is(tbody, tfoot)>tr[hidden] {
    display: none !important;
  }

  main table.phone-cards .btn {
    margin: 2px 3px 2px 0;
    min-height: 36px;
    min-width: 36px;
  }

  main table.phone-cards :is(a, span, small, strong) {
    overflow-wrap: anywhere;
  }

  main table.phone-cards .badge {
    white-space: normal;
    text-align: left;
  }

  .crm-shell main {
    min-width: 0;
  }

  .crm-shell main .admin-section-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .crm-shell main .admin-section-title {
    min-width: 0;
    flex-wrap: wrap;
  }

  .crm-shell main .admin-search {
    width: 100%;
    max-width: none;
  }
}


/* Shared Utility CSS */
.crm-numeric {
  font-variant-numeric: tabular-nums;
}

.crm-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.crm-clickable {
  cursor: pointer;
}

.sales-notes {
  max-width: 350px;
  overflow-wrap: anywhere;
}

/* Tickets CSS */
#ticketChart {
  max-height: 200px;
}

/* Sales Tracker CSS */
.sales-history {
  max-height: 360px;
  overflow-y: auto;
}

.sales-history-entry {
  border-left: 3px solid #9db4be;
  padding: .5rem .8rem;
  margin: .6rem 0;
  background: #f6f9fb;
  border-radius: 0 6px 6px 0;
  overflow-wrap: anywhere;
}

/* Sales Tracker Detail CSS */
.sales-lead-detail {
  scroll-margin-top: 70px;
  overflow-wrap: anywhere;
}

/* Sales Tracker Expandable Rows */
.sales-lead-row {
  cursor: pointer;
}

#lead-table .sales-lead-expansion[hidden] {
  display: none !important;
}

#lead-table .sales-lead-expansion>td {
  padding: 1rem;
  white-space: normal;
}
