:root {
  --crm-navy: #17263a;
  --crm-navy-soft: #263950;
  --crm-gold: #b8894d;
  --crm-gold-soft: #f6efe6;
  --crm-bg: #f5f7fa;
  --crm-border: #e3e8ef;
  --crm-muted: #66758a;
  --crm-sidebar-width: 272px;
}

body {
  background: var(--crm-bg);
  color: var(--crm-navy);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  overflow-x: hidden;
}

.app {
  background: var(--crm-bg);
}

/* Keep the navigation rail continuous on long listing pages.  Sticky positioning
   can end with the flex container after a long scroll, leaving a visible gap. */
@media (min-width: 901px) {
  .sidebar {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100vh;
  }

  .main {
    width: calc(100% - var(--crm-sidebar-width));
    margin-left: var(--crm-sidebar-width);
  }

  body.sidebar-collapsed .main {
    width: calc(100% - 88px);
    margin-left: 88px;
  }
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 80;
  width: var(--crm-sidebar-width);
  height: 100vh;
  min-height: 100vh;
  padding: 24px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--crm-border);
  box-shadow: 8px 0 30px rgba(23, 38, 58, 0.035);
  transition: width 220ms ease, padding 220ms ease, transform 220ms ease;
}

.brand-logo {
  min-width: 224px;
  margin: 0 0 38px;
  padding: 0 12px 22px;
  border-bottom: 1px solid #edf0f4;
}

.brand-logo img {
  width: 148px;
  max-height: 42px;
}

.sidebar button {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 224px;
  margin: 3px 0;
  padding: 13px 16px;
  color: #3e4b5e;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(227, 232, 239, 0.62);
  border-radius: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 4px 14px rgba(23, 38, 58, 0.025);
  backdrop-filter: blur(10px) saturate(125%);
  -webkit-backdrop-filter: blur(10px) saturate(125%);
  font-size: 15px;
  font-weight: 550;
  line-height: 1.25;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.sidebar button:hover {
  color: var(--crm-navy);
  background: rgba(246, 239, 230, 0.76);
  border-color: rgba(184, 137, 77, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 7px 18px rgba(23, 38, 58, 0.07);
  transform: translateX(2px);
}

.sidebar button.active {
  color: #9c6934;
  background: linear-gradient(135deg, rgba(250, 246, 240, 0.94), rgba(239, 224, 204, 0.72));
  border-color: rgba(184, 137, 77, 0.4);
  box-shadow: inset 3px 0 0 var(--crm-gold), inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 8px 20px rgba(117, 78, 38, 0.09);
  font-weight: 700;
}

.sidebar .logout {
  margin-top: 30px;
  color: #b42318 !important;
  border-top: 1px solid #edf0f4;
  border-radius: 0 0 10px 10px;
  padding-top: 20px;
}

.sidebar-toggle {
  position: fixed;
  top: 10px;
  left: 16px;
  z-index: 120;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: #8f6235;
  background: #fff;
  border: 1px solid #d9c09e;
  border-radius: 7px;
  box-shadow: 0 3px 10px rgba(23, 38, 58, 0.1);
  cursor: pointer;
  font: 700 17px/1 "Segoe UI", sans-serif;
  transition: left 220ms ease, color 150ms ease, background 150ms ease;
}

.sidebar-toggle[hidden] {
  display: none !important;
}

.sidebar-toggle:hover {
  color: #fff;
  background: var(--crm-gold);
  transform: none;
}

.sidebar-toggle:focus-visible {
  outline: 3px solid rgba(184, 137, 77, 0.35);
  outline-offset: 2px;
}

body.sidebar-collapsed .sidebar {
  width: 88px;
  padding: 18px 12px;
  overflow: visible;
  border-right-width: 1px;
  box-shadow: 5px 0 18px rgba(23, 38, 58, 0.04);
}

body.sidebar-collapsed .sidebar-toggle {
  left: 22px;
  color: var(--crm-navy);
  background: #fff;
  border-color: #d7b98e;
}

body.sidebar-collapsed .topbar {
  padding-left: 32px;
}

body.sidebar-collapsed .topbar h2 {
  margin-left: 0;
}

body:not(.sidebar-collapsed) .brand-logo {
  padding-left: 42px;
}

body.sidebar-collapsed .brand-logo {
  min-width: 64px;
  height: 48px;
  margin-bottom: 28px;
  padding: 0 0 14px;
  text-align: center;
}

body.sidebar-collapsed .brand-logo img,
body.sidebar-collapsed .brand-logo span {
  display: none;
}

body.sidebar-collapsed .sidebar button {
  position: relative;
  width: 64px;
  min-width: 64px;
  height: 50px;
  margin: 5px 0;
  padding: 0;
  overflow: visible;
  justify-content: center;
  color: #344459;
  text-align: center;
  text-indent: -9999px;
  transform: none;
}

body.sidebar-collapsed .sidebar button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  background: #344459;
  -webkit-mask: var(--nav-icon) center / contain no-repeat;
  mask: var(--nav-icon) center / contain no-repeat;
  text-indent: 0;
  transform: translate(-50%, -50%);
}

body.sidebar-collapsed .sidebar button.active::before {
  background: var(--crm-gold);
}

.nav-dashboard { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z'/%3E%3C/svg%3E"); }
.nav-add { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' stroke-linecap='round' d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.nav-listings { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M5 4h14v16H5zM8 8h8M8 12h8M8 16h5'/%3E%3C/svg%3E"); }
.nav-land { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M3 20h18M5 20V9l7-5 7 5v11M9 20v-6h6v6'/%3E%3C/svg%3E"); }
.nav-concluded { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M5 12l4 4L19 6'/%3E%3C/svg%3E"); }
.nav-users { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); }
.nav-logout { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M10 17l5-5-5-5M15 12H3M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4'/%3E%3C/svg%3E"); }

body.sidebar-collapsed .sidebar button:hover::after {
  content: attr(data-nav-label);
  position: absolute;
  top: 50%;
  left: 74px;
  z-index: 200;
  width: max-content;
  padding: 8px 11px;
  color: #fff;
  background: var(--crm-navy);
  border-radius: 6px;
  box-shadow: 0 5px 14px rgba(23, 38, 58, 0.18);
  font: 600 13px/1 "Segoe UI", sans-serif;
  transform: translateY(-50%);
  pointer-events: none;
}

body.sidebar-collapsed .sidebar .logout {
  margin-top: 24px;
  padding-top: 0;
  border-top: 1px solid #edf0f4;
}

.main {
  background: var(--crm-bg);
  padding: 0 32px 36px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 72px;
  margin: 0 -32px 30px;
  padding: 0 32px 0 42px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--crm-border);
  box-shadow: 0 5px 18px rgba(23, 38, 58, 0.035);
  backdrop-filter: blur(10px);
}

.topbar h2 {
  margin: 0;
  color: var(--crm-navy);
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.topbar-actions p {
  color: var(--crm-muted);
  font-size: 14px;
  font-weight: 600;
}

.card,
.welcome-card,
.dash-card,
.users-table-panel,
.property-card,
.removal-requests-panel,
.ppt-options-panel {
  border-color: var(--crm-border);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(23, 38, 58, 0.06);
}

.property-card {
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.property-card:hover {
  border-color: #d8c2a9;
  box-shadow: 0 12px 32px rgba(23, 38, 58, 0.1);
  transform: translateY(-1px);
}

input,
select,
textarea {
  min-height: 44px;
  color: var(--crm-navy);
  background-color: #fff;
  border-color: #d9e0e8;
  border-radius: 9px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--crm-gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(184, 137, 77, 0.14);
}

.primary {
  background: var(--crm-navy);
  border-radius: 9px;
  box-shadow: 0 6px 14px rgba(23, 38, 58, 0.14);
  font-weight: 700;
}

.primary:hover {
  background: var(--crm-navy-soft);
}

.secondary {
  color: var(--crm-navy);
  border-color: #d5b98f;
  border-radius: 9px;
  font-weight: 650;
}

.secondary:hover {
  background: #faf6f0;
}

.vertical-badge,
.role-pill {
  color: #936131;
  background: var(--crm-gold-soft);
  border-color: #ead9c1;
}

/* Keep the floating chat panel and its launcher on the same right edge. */
.live-chat-widget {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: min(440px, calc(100vw - 32px));
}

.live-chat-panel {
  width: 100%;
  margin: 0 0 12px;
}

.live-chat-users {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  align-items: stretch;
}

.live-chat-users button {
  width: 100%;
  min-height: 44px;
  margin: 0;
  white-space: nowrap;
}

.live-chat-form input {
  min-width: 0;
  flex: 1 1 auto;
}

.live-chat-form button {
  flex: 0 0 92px;
  min-height: 44px;
}

.live-chat-trigger {
  flex: 0 0 58px;
  margin: 0;
}

@media (max-width: 520px) {
  .live-chat-widget {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .live-chat-users {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.professional-team-panel {
  margin-top: 18px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--crm-border);
}

.professional-team-panel .users-table-title {
  margin-bottom: 18px;
}

.professional-team-panel .users-table-title h3 {
  margin: 0 0 6px;
  color: var(--crm-navy);
  font-size: 18px;
  letter-spacing: -0.015em;
}

.professional-team-panel .users-table-title p {
  margin: 0;
  color: var(--crm-muted);
  font-size: 14px;
}

.professional-team-panel .users-table {
  gap: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--crm-border);
  border-radius: 12px;
}

.professional-team-panel .users-table-row {
  grid-template-columns: minmax(155px, 1.05fr) 145px minmax(145px, 0.85fr) minmax(225px, 1.2fr);
  gap: 12px;
  min-height: 76px;
  padding: 12px 14px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #e9edf2;
  border-radius: 0;
}

.professional-team-panel .users-table-row:last-child {
  border-bottom: 0;
}

/* Team structure: card-based layout makes reporting changes easy to scan. */
.professional-team-panel .users-table {
  display: grid;
  gap: 12px;
  overflow: visible;
  padding: 0;
  background: transparent;
  border: 0;
}

.professional-team-panel .users-table-head {
  display: none;
}

.professional-team-panel .users-table-row:not(.users-table-head) {
  display: grid;
  grid-template-columns: minmax(215px, 1.05fr) minmax(145px, 0.72fr) minmax(190px, 0.95fr) minmax(300px, 1.3fr);
  gap: 0;
  min-height: 122px;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--crm-border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(23, 38, 58, 0.035);
}

.professional-team-panel .users-table-row:not(.users-table-head):hover {
  background: #fff;
  border-color: #d6c0a5;
  box-shadow: 0 8px 22px rgba(23, 38, 58, 0.07);
}

.professional-team-panel .team-structure-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 18px 16px;
  border-right: 1px solid #edf0f4;
}

.professional-team-panel .team-structure-cell:last-child {
  border-right: 0;
}

.professional-team-panel .team-structure-cell::before {
  display: block;
  margin-bottom: 7px;
  color: #8793a3;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  content: attr(data-label);
}

.professional-team-panel .team-member-cell {
  background: linear-gradient(115deg, #fbfcfe, #fff);
}

.professional-team-panel .user-identity strong,
.professional-team-panel .assigned-team strong {
  display: block;
  margin-bottom: 4px;
  color: var(--crm-navy);
  font-size: 15px;
}

.professional-team-panel .team-access-cell > div,
.professional-team-panel .team-access-cell > span {
  align-self: flex-start;
}

.professional-team-panel .role-pill,
.professional-team-panel .team-select {
  min-height: 36px;
}

.professional-team-panel .team-action-cell {
  gap: 10px;
  justify-content: center;
}

.professional-team-panel .hierarchy-action {
  width: 100%;
  grid-template-columns: minmax(150px, 1fr) 66px;
}

.professional-team-panel .hierarchy-save-button {
  min-height: 42px;
  border-radius: 8px;
}

.member-access-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.member-access-actions > span {
  color: var(--crm-muted);
  font-size: 11px;
  font-weight: 650;
}

.access-control-button {
  margin: 0 !important;
  padding: 7px 10px !important;
}

.professional-team-panel .users-table-row:not(.users-table-head):hover {
  background: #fbfcfd;
}

.professional-team-panel .users-table-head {
  min-height: 48px;
  color: #fff;
  background: var(--crm-navy);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.professional-team-panel .user-identity strong,
.professional-team-panel .assigned-team strong {
  color: var(--crm-navy);
  font-size: 15px;
}

.professional-team-panel .user-identity span,
.professional-team-panel .assigned-team span,
.professional-team-panel .muted-text {
  color: var(--crm-muted);
  font-size: 12.5px;
}

.access-control-button {
  width: auto !important;
  min-width: 0 !important;
  min-height: 28px !important;
  margin: 8px 0 0 !important;
  padding: 4px 9px !important;
  color: #a33a32 !important;
  background: #fff6f5 !important;
  border: 1px solid #efc2be !important;
  border-radius: 7px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

.access-control-button.is-restricted {
  color: #23613d !important;
  background: #f1faf5 !important;
  border-color: #b9ddc8 !important;
}

.user-delete-button {
  width: auto !important;
  min-width: 0 !important;
  min-height: 28px !important;
  margin: 8px 0 0 !important;
  padding: 4px 9px !important;
  color: #fff !important;
  background: #bd3d35 !important;
  border: 1px solid #bd3d35 !important;
  border-radius: 7px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

.user-delete-button:hover:not(:disabled) { background: #9f2f29 !important; }
.user-delete-button:disabled { opacity: 0.55; cursor: not-allowed; }

/* Team directory: show leaders first, then reveal their team on demand. */
.team-directory {
  margin: 0 0 18px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--crm-border);
  border-radius: 12px;
}

.team-directory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.team-directory-header strong,
.team-directory-header span {
  display: block;
}

.team-directory-header strong {
  color: var(--crm-navy);
  font-size: 15px;
}

.team-directory-header span {
  margin-top: 3px;
  color: var(--crm-muted);
  font-size: 12px;
}

.team-directory-manage {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  color: #805323;
  background: #fff;
  border: 1px solid #dec19c;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.team-directory-manage:hover,
.team-directory.is-managing .team-directory-manage {
  color: #fff;
  background: var(--crm-navy);
  border-color: var(--crm-navy);
}

.team-directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}

.team-directory-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid #e1e7ee;
  border-radius: 10px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.team-directory-card:hover,
.team-directory-card.is-open {
  border-color: #d4b485;
  box-shadow: 0 6px 18px rgba(23, 38, 58, 0.07);
}

.team-directory-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 13px;
  color: var(--crm-navy);
  text-align: left;
  background: #fff;
  border: 0;
  cursor: pointer;
}

.team-directory-avatar {
  flex: 0 0 36px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #89582a;
  background: #f5eadc;
  border: 1px solid #ead6ba;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}

.team-directory-lead {
  flex: 1 1 auto;
  min-width: 0;
}

.team-directory-lead strong,
.team-directory-lead small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-directory-lead strong {
  font-size: 14px;
}

.team-directory-lead small {
  margin-top: 2px;
  color: var(--crm-muted);
  font-size: 11px;
}

.team-directory-role,
.team-directory-count,
.team-directory-restricted {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.team-directory-role {
  padding: 5px 7px;
  color: #89582a;
  background: #f9f1e6;
  border: 1px solid #e7d1b2;
}

.team-directory-count {
  color: var(--crm-muted);
}

.team-directory-meta {
  display: flex;
  align-items: flex-end;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 5px;
  min-width: 78px;
  text-align: right;
}

.team-directory-meta .team-directory-count {
  color: var(--crm-muted);
}

.team-directory-chevron {
  flex: 0 0 18px;
  color: #7b8796;
  font-size: 18px;
  transition: transform 160ms ease;
}

.team-directory-card.is-open .team-directory-chevron { transform: rotate(180deg); }

/* Keep card metadata insulated from older dashboard button/span rules. */
.team-directory .team-directory-toggle {
  display: flex !important;
  min-height: 76px;
}

.team-directory .team-directory-meta {
  display: flex !important;
  position: static !important;
  align-items: flex-end;
  justify-content: center;
  flex: 0 0 88px;
  flex-direction: column;
  gap: 5px;
  margin: 0 !important;
  padding: 0 !important;
}

.team-directory .team-directory-meta .team-directory-role,
.team-directory .team-directory-meta .team-directory-count {
  display: inline-flex !important;
  position: static !important;
  grid-area: auto !important;
  float: none !important;
  margin: 0 !important;
  transform: none !important;
}

.team-directory .team-directory-meta .team-directory-count {
  min-height: 12px;
  padding: 0;
}

.team-directory-team {
  padding: 4px 13px 13px 59px;
  border-top: 1px solid #edf1f5;
}

.team-directory-team > p,
.team-directory-empty {
  margin: 8px 0 0;
  color: var(--crm-muted);
  font-size: 12px;
}

.team-directory-team ul,
.team-directory-children {
  margin: 0;
  padding: 0;
  list-style: none;
}

.team-directory-member {
  padding: 11px 0 0 calc(var(--directory-depth) * 13px);
}

.team-directory-member-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.team-directory-member-name {
  color: var(--crm-navy);
  font-size: 13px;
  font-weight: 750;
}

.team-directory-member-email {
  display: block;
  margin-top: 2px;
  color: var(--crm-muted);
  font-size: 11px;
}

.team-directory-member .team-directory-role { padding: 4px 6px; }
.team-directory-restricted {
  padding: 4px 6px;
  color: #a23a32;
  background: #fff4f3;
  border: 1px solid #edc5c0;
}

.team-structure-details[hidden] { display: none !important; }

.professional-team-panel .role-pill {
  min-height: 30px;
  padding: 5px 11px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 750;
}

.professional-team-panel .hierarchy-action {
  grid-template-columns: minmax(145px, 1fr) 64px;
  gap: 8px;
}

.professional-team-panel .team-select {
  min-height: 42px;
  color: var(--crm-navy);
  background-color: #fff;
  border-color: #d9e0e8;
  font-size: 14px;
}

.professional-team-panel .hierarchy-save-button {
  min-height: 42px;
  padding: 0 10px;
  color: #fff;
  background: var(--crm-navy);
  border-color: var(--crm-navy);
  font-size: 13px;
}

.professional-team-panel .hierarchy-save-button:hover:not(:disabled) {
  background: var(--crm-navy-soft);
}

.professional-team-panel .hierarchy-save-button:disabled {
  color: #8994a3;
  background: #edf0f4;
  border-color: #edf0f4;
}

.user-limit-panel {
  margin: 0 0 18px;
  padding: 14px 16px;
  color: var(--crm-navy);
  background: #fffaf2;
  border: 1px solid #ead7b9;
  border-radius: 10px;
}

.user-limit-panel > div,
.user-limit-heading > div,
.user-limit-request {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.user-limit-panel strong,
.user-limit-panel span {
  display: block;
}

.user-limit-panel span,
.user-limit-panel p {
  margin: 4px 0 0;
  color: var(--crm-muted);
  font-size: 13px;
}

.user-limit-request {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eadfd0;
}

.user-limit-actions {
  display: flex;
  gap: 8px;
}

.user-limit-actions button {
  min-height: 36px;
  padding: 0 13px;
  color: var(--crm-navy);
  background: #fff;
  border: 1px solid #d5b98f;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.user-limit-actions button:last-child {
  color: #fff;
  background: var(--crm-navy);
  border-color: var(--crm-navy);
}

@media (max-width: 1050px) {
  .professional-team-panel .users-table {
    overflow-x: auto;
  }

  .professional-team-panel .users-table-row {
    min-width: 780px;
  }
}

@media (max-width: 1050px) {
  .professional-team-panel .users-table {
    overflow: visible;
  }

  .professional-team-panel .users-table-row:not(.users-table-head) {
    grid-template-columns: 1fr 1fr;
    min-width: 0;
  }

  .professional-team-panel .team-structure-cell:nth-child(2) {
    border-right: 0;
  }

  .professional-team-panel .team-structure-cell:nth-child(-n + 2) {
    border-bottom: 1px solid #edf0f4;
  }
}

@media (max-width: 620px) {
  .professional-team-panel .users-table-row:not(.users-table-head) {
    grid-template-columns: 1fr;
  }

  .professional-team-panel .team-structure-cell,
  .professional-team-panel .team-structure-cell:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid #edf0f4;
  }

  .professional-team-panel .team-structure-cell:last-child {
    border-bottom: 0;
  }

  .professional-team-panel .hierarchy-action {
    grid-template-columns: 1fr 74px;
  }

  .team-directory-header { align-items: flex-start; flex-direction: column; }
  .team-directory-manage { width: 100%; }
  .team-directory-team { padding-left: 18px; }

  .team-directory-toggle { align-items: flex-start; }
  .team-directory-meta { align-items: flex-start; min-width: 0; }

  .listing-vertical-filter-panel {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .listing-vertical-filter-panel label,
  .listing-vertical-filter-select,
  .listing-vertical-filter-result,
  .listing-filter-select-button,
  .listing-vertical-filter-hint { grid-column: 1; }
}

@media (min-width: 1051px) and (max-width: 1400px) {
  .main {
    padding-right: 20px;
    padding-left: 20px;
  }

  .topbar {
    margin-right: -20px;
    margin-left: -20px;
  }

  .card {
    padding: 18px;
  }

  .professional-team-panel {
    padding: 14px;
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    width: min(82vw, var(--crm-sidebar-width));
    box-shadow: 12px 0 32px rgba(23, 38, 58, 0.18);
  }

  body.sidebar-collapsed .sidebar {
    width: min(82vw, var(--crm-sidebar-width));
    padding: 24px 18px;
    transform: translateX(-105%);
  }

  .sidebar-toggle,
  body.sidebar-collapsed .sidebar-toggle {
    left: 14px;
  }

  body:not(.sidebar-collapsed) .sidebar-toggle {
    left: min(calc(82vw - 18px), calc(var(--crm-sidebar-width) - 18px));
  }

  .main {
    width: 100%;
    padding: 0 16px 24px;
  }

  .topbar {
    margin: 0 -16px 22px;
    padding: 0 16px 0 58px;
  }

  body.sidebar-collapsed .topbar h2 {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-toggle,
  .sidebar button,
  .property-card {
    transition: none;
  }
}

/* Refined first-screen experience. */
.main:has(.dashboard-page) {
  min-height: 100vh;
  background: #fff;
}

.dashboard-page {
  width: 100%;
  min-height: calc(100vh - 126px);
  margin: 0 auto;
}

.dashboard-page .welcome-card {
  position: relative;
  min-height: 280px;
  padding: 44px 36px;
  overflow: visible;
  color: var(--crm-navy);
  background: #fff;
  border: 1px solid var(--crm-border);
  border-top: 3px solid var(--crm-gold);
  border-radius: 3px;
  box-shadow: 0 8px 24px rgba(23, 38, 58, 0.055);
}

.dashboard-page .welcome-card::after {
  display: none;
}

.dashboard-page .welcome-card > div {
  position: relative;
  z-index: 1;
}

.dashboard-page .welcome-card h1 {
  margin: 0 0 10px;
  color: var(--crm-navy);
  font-size: clamp(28px, 2.4vw, 38px);
  letter-spacing: -0.035em;
}

.dashboard-page .welcome-card p {
  color: var(--crm-muted);
}

.dashboard-page .vertical-select-box label {
  color: var(--crm-navy);
}

.dashboard-page .vertical-menu-trigger {
  background: #fff;
  border-color: #d5dde6;
}

.dashboard-page .dashboard-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.dashboard-page .dash-card {
  position: relative;
  min-height: 150px;
  padding: 24px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--crm-border);
  border-radius: 3px;
  box-shadow: 0 7px 20px rgba(23, 38, 58, 0.05);
  transition: none;
  transform: none;
}

.dashboard-page .dash-card:hover {
  transform: none;
}

.dashboard-page .dash-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--crm-gold), #e1c296);
}

.dashboard-page .dash-card h2 {
  color: var(--crm-navy);
  font-size: 34px;
}

.dashboard-page .dash-card p {
  color: var(--crm-muted);
}

.listing-phone-input {
  border-color: rgba(184, 137, 77, 0.55) !important;
  background: #fffdf9 !important;
}

.listing-contact-group {
  grid-column: 1 / -1;
  padding: 14px;
  background: #fffdf9;
  border: 1px solid #ead8c2;
  border-radius: 11px;
}

.listing-contact-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 11px;
  color: var(--crm-navy);
  font-size: 13px;
  font-weight: 750;
}

.listing-contact-heading span {
  color: var(--crm-muted);
  font-size: 11px;
  font-weight: 500;
}

.listing-contact-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.listing-contact-fields input {
  min-width: 0;
  background: #fff;
  border-color: #e3d5c4;
}

@media (max-width: 800px) {
  .listing-contact-fields { grid-template-columns: 1fr; }
}

.private-listing-phone {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  min-height: 48px;
  margin: 10px 0 13px;
  padding: 8px 10px;
  color: var(--crm-navy);
  background: linear-gradient(135deg, #fffdf9, #f9f2e8);
  border: 1px solid #ead8c2;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(23, 38, 58, 0.035);
}

.private-listing-phone-icon {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #946231;
  background: #f1e2ce;
  border-radius: 8px;
  font-size: 17px;
  line-height: 1;
}

.private-listing-phone-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.private-listing-phone-caption {
  color: var(--crm-muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
}

.private-listing-phone-value {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
}

.private-listing-phone-identity {
  color: var(--crm-navy-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.private-listing-phone-identity:empty { display: none; }

.private-listing-phone.is-empty .private-listing-phone-value {
  color: #7d6d5b;
  font-weight: 550;
}

.private-listing-phone-privacy {
  flex: 0 0 auto;
  margin-left: 4px;
  padding: 5px 7px;
  color: #815522;
  background: rgba(241, 226, 206, 0.7);
  border: 1px solid rgba(184, 137, 77, 0.23);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.listing-vertical-filter-panel {
  display: grid;
  grid-template-columns: max-content minmax(220px, 250px);
  align-items: center;
  gap: 10px 14px;
  width: min(100%, 580px);
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #fbfcfe;
  border: 1px solid var(--crm-border);
  border-radius: 10px;
}

.listing-vertical-filter-panel label {
  grid-column: 1;
  color: var(--crm-navy);
  font-size: 13px;
  font-weight: 700;
}

.listing-vertical-filter-select {
  grid-column: 2;
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 8px 34px 8px 12px;
  color: var(--crm-navy);
  background: #fff;
  border: 1px solid #d3dce8;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.listing-vertical-filter-result {
  grid-column: 1 / -1;
  color: var(--crm-muted);
  font-size: 12px;
}

.listing-filter-select-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-column: 1 / -1;
  justify-self: start;
  width: auto;
  height: 38px;
  padding: 0 13px;
  color: #825423;
  background: #fff8ef;
  border: 1px solid #ddbf9b;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.listing-filter-select-button:hover { background: #f8ead7; }
.listing-filter-select-button[hidden] { display: none !important; }
.listing-vertical-filter-hint {
  grid-column: 1 / -1;
  color: #805932;
  font-size: 11px;
}
.listing-vertical-filter-hint[hidden] { display: none !important; }
.property-card.vertical-filter-hidden { display: none !important; }
.generate-trigger.vertical-filter-generate-all-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* The vertical filter belongs with the Listing Data toolbar actions. */
.listing-toolbar:not(.land-toolbar) .listing-vertical-filter-panel { display: contents; }
.listing-toolbar:not(.land-toolbar) .listing-vertical-filter-panel label,
.listing-toolbar:not(.land-toolbar) .listing-vertical-filter-hint { display: none !important; }
.listing-toolbar:not(.land-toolbar) .listing-vertical-filter-select {
  flex: 0 1 235px;
  width: 235px;
  height: 46px;
  margin: 0;
}
.listing-toolbar:not(.land-toolbar) .listing-vertical-filter-result {
  flex: 0 0 auto;
  align-self: center;
  margin: 0 2px;
  white-space: nowrap;
}
.listing-toolbar:not(.land-toolbar) .listing-filter-select-button {
  flex: 0 0 auto;
  align-self: center;
  height: 42px;
  margin: 0;
}

.listing-toolbar:not(.land-toolbar) .listing-filter-clear-button {
  flex: 0 0 auto;
  min-height: 46px;
  margin: 0;
  padding: 0 14px;
  color: #825423;
  background: #fff8ef;
  border-color: #ddbf9b;
  font-size: 13px;
  font-weight: 700;
}

.crm-privacy-notice {
  color: #667085;
  text-align: center;
  max-width: 360px;
  margin: 18px auto 0;
  font-size: 11px;
  line-height: 1.45;
}

.activity-log-trigger {
  min-height: 34px;
  padding: 0 10px;
  color: #825423;
  background: #fff8ef;
  border: 1px solid #ddbf9b;
  border-radius: 7px;
  font: 700 12px/1 Inter, "Segoe UI", sans-serif;
  cursor: pointer;
}

.dashboard-update-button {
  min-height: 34px;
  padding: 0 11px;
  color: #fff;
  background: var(--crm-navy);
  border: 1px solid var(--crm-navy);
  border-radius: 7px;
  font: 700 12px/1 Inter, "Segoe UI", sans-serif;
  cursor: pointer;
}

.dashboard-update-button:hover:not(:disabled) { background: #263b56; }
.dashboard-update-button:disabled { opacity: 0.72; cursor: wait; }

.activity-log-panel {
  z-index: 60;
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: min(390px, calc(100vw - 30px));
  max-height: 430px;
  padding: 14px;
  overflow: auto;
  color: var(--crm-navy);
  background: #fff;
  border: 1px solid var(--crm-border);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(23, 38, 58, 0.18);
}

.activity-log-panel > strong { display: block; margin-bottom: 8px; }
.activity-log-panel > p { margin: 0; color: var(--crm-muted); font-size: 12px; }
.activity-log-panel ul { margin: 0; padding: 0; list-style: none; }
.activity-log-panel li { padding: 9px 0; border-top: 1px solid #edf1f5; }
.activity-log-panel li b,
.activity-log-panel li span,
.activity-log-panel li small { display: block; }
.activity-log-panel li b { font-size: 12px; }
.activity-log-panel li span { margin-top: 2px; color: #7a5531; font-size: 12px; }
.activity-log-panel li small { margin-top: 3px; color: var(--crm-muted); font-size: 10px; }

.concluded-download-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 38px;
  margin: 0 0 14px auto;
  padding: 0 14px;
  color: #fff;
  background: var(--crm-navy);
  border: 1px solid var(--crm-navy);
  border-radius: 8px;
  font: 700 12px/1 Inter, "Segoe UI", sans-serif;
  cursor: pointer;
}

.concluded-download-button::before { content: "↓"; margin-right: 7px; font-size: 16px; }
.concluded-download-button:hover:not(:disabled) { background: #263b56; }
.concluded-download-button:disabled { opacity: 0.45; cursor: not-allowed; }

.reactivate-listing-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 14px;
  right: 14px;
  margin: 0;
  padding: 9px 12px;
  color: #7a4a00;
  background: #fff8e6;
  border: 1px solid #e8c878;
  border-radius: 8px;
  font: 600 13px/1.2 Inter, "Segoe UI", sans-serif;
  cursor: pointer;
}

.concluded-property-card .property-title-row {
  padding-right: 115px;
}

.reactivate-listing-button:hover,
.reactivate-listing-button:focus-visible {
  background: #fff1c7;
  border-color: #bd8b13;
  outline: none;
}

.reactivate-listing-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 680px) {
  .reactivate-listing-button {
    position: static;
    margin-top: 12px;
  }

  .concluded-property-card .property-title-row {
    padding-right: 0;
  }
}

@media (max-width: 1180px) {
  .dashboard-page .dashboard-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .dashboard-page .welcome-card {
    min-height: auto;
    padding: 30px 24px;
  }

  .dashboard-page .dashboard-cards {
    grid-template-columns: 1fr;
  }
}

.login-page .original-login-box {
  width: min(1040px, calc(100vw - 48px)) !important;
  height: min(580px, calc(100vh - 48px)) !important;
  border-radius: 16px !important;
}

.login-page .login-title {
  max-width: 390px !important;
  padding-left: 64px !important;
  font-size: clamp(30px, 3vw, 42px) !important;
}

.login-page .login-title::after {
  content: "Manage listings, teams and property opportunities from one secure workspace" !important;
  max-width: 330px;
  font-size: 15px !important;
}

.login-page .original-login-card {
  width: 374px !important;
  padding: 34px 34px 30px !important;
  border-top: 4px solid var(--crm-gold) !important;
}

@media (max-width: 860px) {
  .login-page .login-title {
    padding-left: 0 !important;
  }
}

/* Compact, consistently aligned live-chat window. */
.live-chat-widget {
  right: 22px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.live-chat-panel {
  width: min(400px, calc(100vw - 32px));
  margin: 0 0 12px;
  border-radius: 14px;
}

.live-chat-header {
  min-height: 62px;
  padding: 12px 16px;
}

.live-chat-users {
  flex-wrap: nowrap;
  gap: 8px;
  max-height: none;
  padding: 10px 14px;
  overflow-x: auto;
  overflow-y: hidden;
}

.live-chat-users button {
  min-width: 84px;
  height: 38px;
  padding: 0 13px;
}

.live-chat-messages {
  height: min(280px, calc(100vh - 285px));
  min-height: 190px;
  gap: 10px;
  padding: 16px;
}

.chat-message {
  max-width: 74%;
}

.live-chat-form {
  gap: 10px;
  padding: 12px 14px 14px;
}

.live-chat-form input,
.live-chat-form button {
  height: 44px;
}

.live-chat-form button {
  flex-basis: 78px;
}

@media (max-width: 520px) {
  .live-chat-widget {
    right: 12px;
    bottom: 12px;
  }

  .live-chat-panel {
    width: calc(100vw - 24px);
  }
}
