*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Open Sans', sans-serif;
  background: linear-gradient(to bottom, #ffffff 0, #f4f5f8 60px) no-repeat #f4f5f8;
  color: #1c2333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  outline: none;
}

*:focus {
  outline: none;
}

.header {
  background: transparent;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding-top: 4px;
}

.logo {
  height: 56px;
  position: relative;
  top: 10px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 6px;
  color: #636b7f;
  transition: background 0.15s;
}

.nav-link:hover {
  background: rgba(0, 0, 0, 0.04);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.nav-dropdown-menu {
  left: 0;
  right: auto;
  width: 200px;
}

.user-menu {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #1c2333;
  transition: background 0.15s;
}

.user-menu-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.user-menu-btn svg {
  color: #636b7f;
}

.user-menu-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.user-menu-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #b22c57;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  animation: badgeBounce 1.8s cubic-bezier(0.28, 0.84, 0.42, 1) infinite;
  transform-origin: center bottom;
  will-change: transform;
}

@keyframes badgeBounce {
  0%   { transform: translateY(0); }
  10%  { transform: translateY(-7px); }
  20%  { transform: translateY(0); }
  28%  { transform: translateY(-4px); }
  36%  { transform: translateY(0); }
  44%  { transform: translateY(-2px); }
  50%  { transform: translateY(0); }
  100% { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .user-menu-badge { animation: none; }
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  width: 240px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  padding: 8px;
  z-index: 100;
}

.dropdown-menu.open {
  display: block;
}

.dropdown-label {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dropdown-name {
  font-size: 14px;
  font-weight: 500;
}

.dropdown-email {
  font-size: 12px;
  color: #636b7f;
}

.dropdown-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 4px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 6px;
  color: #1c2333;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.dropdown-item svg {
  color: #636b7f;
}

.dropdown-item-label {
  flex: 1;
}

.dropdown-item-stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
}
.dropdown-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #1c2333;
  line-height: 1.2;
}
.dropdown-item-desc {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.35;
}
[data-theme="dark"] .dropdown-item-title { color: #e6e9ef; }
[data-theme="dark"] .dropdown-item-desc { color: #9099a8; }

.dropdown-item-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #b22c57;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.messages-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  min-height: 600px;
  background: #ffffff;
  border: 1px solid #e9ecf1;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  padding: 16px 0 16px 16px;
}

.messages-tabs {
  display: flex;
  align-items: center;
  gap: 18px;
}

.messages-tab {
  font-size: 14px;
  font-weight: 600;
  color: #8b93a3;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.messages-tab:hover {
  color: #1c2333;
}

.messages-tab.is-active {
  color: #3759a6;
  border-bottom-color: #3759a6;
}

.messages-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: color-mix(in srgb, #3759a6 12%, transparent);
  color: #3759a6;
  font-size: 11px;
  font-weight: 600;
}

.messages-tab:not(.is-active) .messages-tab-count {
  background: #eef0f3;
  color: #636b7f;
}

.messages-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.messages-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: #636b7f;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.messages-tool-btn:hover {
  background: #f3f5f8;
  color: #1c2333;
}

.messages-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
}

.messages-sidebar-label {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b93a3;
}

.messages-sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #1c2333;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.messages-sidebar-item:hover {
  background: rgba(15, 23, 42, 0.04);
}

.messages-sidebar-item.is-active {
  background: color-mix(in srgb, var(--filter-color, #3759a6) 10%, transparent);
  color: var(--filter-color, #3759a6);
}

.messages-sidebar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: #636b7f;
}

.messages-sidebar-item.is-active .messages-sidebar-icon {
  color: var(--filter-color, #3759a6);
}

.messages-sidebar-label-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-sidebar-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef0f3;
  color: #636b7f;
  font-size: 11px;
  font-weight: 600;
}

.messages-sidebar-item.is-active .messages-sidebar-count {
  background: color-mix(in srgb, var(--filter-color, #3759a6) 18%, transparent);
  color: var(--filter-color, #3759a6);
}

.messages-list {
  background: #fafbfc;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages-list-header {
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #1c2333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.messages-list-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef0f3;
  color: #636b7f;
  font-size: 11px;
  font-weight: 600;
}

.messages-empty-list {
  padding: 40px 20px;
  text-align: center;
  color: #8b93a3;
  font-size: 13px;
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 28px 24px;
  border-bottom: 1px solid #e7e9ee;
  color: #1c2333;
  transition: background 0.15s;
}

.message-row:hover {
  background: #f1f3f6;
}

.message-row.is-active {
  background: #f1f3f6;
}

.message-row-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3759a6, #5577c4);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message-row-body {
  min-width: 0;
  flex: 1;
}

.message-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.message-row-sender {
  font-size: 13px;
  font-weight: 600;
  color: #1c2333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-row-time {
  font-size: 11px;
  color: #8b93a3;
  flex-shrink: 0;
}

.message-row-subject {
  font-size: 13px;
  color: #1c2333;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-row.is-unread .message-row-subject,
.message-row.is-unread .message-row-sender {
  font-weight: 700;
}

.message-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.message-row-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--chip-color, #636b7f);
  background: color-mix(in srgb, var(--chip-color, #636b7f) 12%, transparent);
  flex-shrink: 0;
  text-transform: uppercase;
}

.message-row-preview {
  font-size: 12px;
  color: #8b93a3;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-row-unread-flag {
  display: inline-flex;
  align-items: center;
  color: #b22c57;
  margin-right: 6px;
  vertical-align: -2px;
}

.message-detail {
  background: #ffffff;
  padding: 24px 32px 24px 16px;
}

.message-detail-empty {
  color: #8b93a3;
  font-size: 14px;
  text-align: center;
  padding: 80px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.message-detail-empty svg {
  color: #c5cbd6;
  margin-bottom: 8px;
}

.message-detail-empty p {
  font-size: 15px;
  font-weight: 600;
  color: #636b7f;
  margin: 0;
}

.message-detail-empty span {
  font-size: 13px;
  color: #8b93a3;
}

.message-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eef0f3;
  margin-bottom: 24px;
}

.message-detail-heading {
  min-width: 0;
  flex: 1;
}

.message-detail-toprow {
  margin-bottom: 10px;
}

.message-detail-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--chip-color, #636b7f);
  background: color-mix(in srgb, var(--chip-color, #636b7f) 12%, transparent);
}

.message-detail-subject {
  font-size: 22px;
  font-weight: 700;
  color: #1c2333;
  margin-bottom: 14px;
  line-height: 1.3;
}

.message-detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.message-detail-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3759a6, #5577c4);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message-detail-meta-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message-detail-sender {
  font-size: 14px;
  font-weight: 600;
  color: #1c2333;
}

.message-detail-time {
  font-size: 12px;
  color: #8b93a3;
}

.message-detail-delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #ffffff;
  color: #b22c57;
  border: 1px solid #f1d6df;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.message-detail-delete:hover {
  background: #fbeef2;
  border-color: #e8b6c4;
}

.message-detail-body {
  font-size: 14px;
  line-height: 1.65;
  color: #2a3142;
}

.message-detail-body p {
  margin: 0 0 12px 0;
}

.message-detail-body ul {
  margin: 0 0 12px 20px;
  padding: 0;
}

.message-detail-body li {
  margin-bottom: 4px;
}

@media (max-width: 1100px) {
  .messages-layout {
    grid-template-columns: 200px 1fr;
  }
  .messages-layout .message-detail {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .messages-layout {
    grid-template-columns: 1fr;
  }
}

.main-content {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
}

.welcome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.welcome-row .events-strip {
  margin: 0;
  margin-left: auto;
  flex: 0 0 auto;
}

.welcome-row .events-strip-viewport {
  width: 460px;
  max-width: 100%;
}

.welcome-back {
  font-size: 22px;
  font-weight: 600;
  color: #1c2333;
  margin: 0;
  flex-shrink: 0;
}

.welcome-section {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.welcome-left {
  flex-shrink: 0;
}

.welcome-title {
  font-size: 24px;
  font-weight: 600;
  color: #1c2333;
}

.welcome-events {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin-top: 4px;
}

.welcome-events-label {
  font-size: 10px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.welcome-event-content {
  overflow: hidden;
  position: relative;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.welcome-event-item {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.welcome-event-sep {
  font-size: 13px;
  color: #9aa3b2;
}

.welcome-event-title {
  font-size: 13px;
  font-weight: 500;
  color: #636b7f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
  text-decoration: none;
}

.welcome-event-title:hover {
  color: #3759a6;
}

.welcome-event-date {
  font-size: 13px;
  font-weight: 400;
  color: #9aa3b2;
}

@keyframes eventSlideUp {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.inbox-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 4px 0;
  border-radius: 6px;
  cursor: pointer;
}

.inbox-link svg {
  color: #636b7f;
}

.inbox-link span {
  font-size: 14px;
  color: #636b7f;
}

.inbox-flag {
  flex-shrink: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .main-nav {
    display: none;
  }
  .header-inner {
    padding: 0 16px;
  }
  .main-content {
    padding: 16px;
  }
  .welcome-events {
    display: none;
  }
}

.card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e8eaee;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.criteria-card,
.affcalc-card,
.notify-card {
  min-height: 500px;
}

.criteria-card {
  border: 2px solid #3759a6;
  background: linear-gradient(to bottom, rgba(55, 89, 166, 0.12) 0%, white 50px);
}

.affcalc-card {
  border: 2px solid #199619;
  background: linear-gradient(to bottom, rgba(25, 150, 25, 0.12) 0%, white 50px);
}

.notify-card {
  border: 2px solid #b22c57;
  background: linear-gradient(to bottom, rgba(178, 44, 87, 0.12) 0%, white 50px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 20px 12px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
}

.new-badge {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #199619;
  color: white;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 20px 16px;
  gap: 12px;
}

.action-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.action-link-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-link span {
  font-size: 13px;
  font-weight: 500;
}

.criteria-action {
  background: rgba(55, 89, 166, 0.05);
  color: #3759a6;
}

.criteria-action:hover {
  background: rgba(55, 89, 166, 0.1);
}

.affcalc-action {
  background: rgba(25, 150, 25, 0.05);
  color: #199619;
}

.affcalc-action:hover {
  background: rgba(25, 150, 25, 0.1);
}

.notify-action {
  background: rgba(178, 44, 87, 0.05);
}

.notify-action:hover {
  background: rgba(178, 44, 87, 0.1);
}

.notify-muted-text {
  color: #b22c57 !important;
}

.notify-invite {
  background: #b22c57;
  color: white;
}

.notify-invite:hover {
  background: #9a2249;
}

.action-count {
  font-size: 14px;
  font-weight: 700;
}

.invite-count {
  color: white !important;
}

.section-divider {
  height: 1px;
}

.criteria-divider {
  background: rgba(55, 89, 166, 0.2);
}

.affcalc-divider {
  background: rgba(25, 150, 25, 0.2);
}

.notify-divider {
  background: rgba(178, 44, 87, 0.2);
}

.section-label {
  font-size: 11px;
  font-weight: 500;
  color: #636b7f;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.recent-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.recent-item-info {
  min-width: 0;
  flex: 1;
}

.recent-item-title {
  font-size: 12px;
  font-weight: 500;
  color: #1c2333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-item-meta {
  font-size: 10px;
  color: #636b7f;
  margin-top: 2px;
}

.recent-item-highlight {
  font-weight: 400;
  color: #1a2433;
}
[data-theme="dark"] .recent-item-highlight { color: #e8eaef; }

.recent-item-chevron {
  flex-shrink: 0;
  color: #636b7f;
}

.card-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  transition: background 0.15s;
}

.stat-link:hover {
  background: rgba(0, 0, 0, 0.03);
}

.stat-link-left {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #636b7f;
}

.stat-link-left span {
  font-size: 12px;
}

.stat-link-text {
  font-size: 12px;
  color: #636b7f;
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
}

.right-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.promo-card {
  flex: 1 1 auto;
  min-height: 330px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  position: relative;
}

@media (max-width: 1200px) {
  .promo-card {
    aspect-ratio: 630 / 660;
  }
}


.promo-card a {
  display: block;
  height: 100%;
}

.promo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.promo-track {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  will-change: transform;
}
.promo-track.is-sliding {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(-100%);
}
.promo-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: block;
}
.promo-slide img.promo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lender-highlight-card {
  flex: 0 0 auto;
  overflow: hidden;
  padding: 0;
}

.lender-highlight-link {
  display: block;
  width: 100%;
  height: 100%;
}

.lender-highlight-img {
  width: 100%;
  height: auto;
  display: block;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-3px); }
  20% { transform: translateX(3px); }
  30% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  50% { transform: translateX(0); }
}

.shake {
  animation: shake 2s ease-in-out infinite;
  animation-delay: 1s;
}

@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}

.shimmer-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 8px;
}

.shimmer-line {
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, #eee 25%, #e0e0e0 37%, #eee 63%);
  background-size: 400px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.shimmer-long {
  width: 80%;
}

.shimmer-short {
  width: 50%;
}

.footer {
  margin-top: auto;
  padding: 48px 0 0;
  background: #f9f9fb;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  gap: 48px;
}

.footer-brand {
  max-width: 340px;
  flex-shrink: 0;
}

.footer-logo {
  height: 28px;
  margin-bottom: 16px;
}

.footer-description {
  font-size: 13px;
  color: #636b7f;
  line-height: 1.6;
  margin-bottom: 20px;
}

.footer-socials {
  display: flex;
  gap: 12px;
}

.footer-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: #636b7f;
  transition: color 0.15s, background 0.15s;
}

.footer-social-link:hover {
  color: #1a202c;
  background: #f0f1f4;
}

.footer-columns {
  display: flex;
  gap: 64px;
}

.footer-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-column-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 4px;
}

.footer-link {
  font-size: 13px;
  color: #636b7f;
  text-decoration: none;
  transition: color 0.15s;
}

.footer-link:hover {
  color: #1a202c;
}

.footer { padding-bottom: 32px; }
.footer-divider, .footer-bottom { display: none; }

.footer-support-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 20px;
}
.footer-support-row .footer-social-link {
  width: auto;
  height: auto;
  padding: 0;
}
.footer-support-row .footer-social-link:hover {
  background: transparent;
}

.footer-brand-meta {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.footer-brand-meta .footer-socials .footer-social-link {
  width: auto;
  height: auto;
  padding: 0;
  margin-left: -2px;
}
.footer-brand-meta .footer-socials .footer-social-link:hover {
  background: transparent;
}
.footer-brand-meta .footer-bottom-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}
.footer-brand-meta .footer-bottom-links .footer-link {
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-copyright {
  font-size: 12px;
  color: #9ca3af;
}

.footer-bottom-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.footer-bottom-links .footer-link {
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 900px) {
  .footer-top {
    flex-direction: column;
    gap: 32px;
  }
  .footer-brand {
    max-width: 100%;
  }
  .footer-columns {
    gap: 32px;
  }
}

@media (max-width: 768px) {
  .footer-inner {
    padding: 0 16px;
  }
  .footer-columns {
    flex-wrap: wrap;
    gap: 24px;
  }
  .footer-column {
    min-width: 120px;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   Refined design (promoted from "Variant A — Softer & Quieter")
   Cards: 1px neutral border + soft shadow instead of 2px brand
   borders. Card titles dark neutral. Action chips use a soft
   tinted background. The Notify "Invited to Place" row matches
   its siblings with a small badge for the count. Inbox flag
   muted to grey. Right-column promo cards share the same family.
   ============================================================ */
.card {
  border: 2px solid #ffffff !important;
  box-shadow: 0 1px 3px rgba(20, 30, 60, 0.04);
}
.criteria-card,
.affcalc-card,
.notify-card {
  border-color: #ffffff !important;
}
.card-title {
  color: #1a2a4a !important;
}
.action-link.criteria-action {
  background: rgba(55, 89, 166, 0.06);
  border: 1px solid transparent;
}
.action-link.affcalc-action {
  background: rgba(25, 150, 25, 0.06);
  border: 1px solid transparent;
}
.action-link.notify-action {
  background: rgba(178, 44, 87, 0.06);
  border: 1px solid transparent;
}
.notify-invite {
  background: rgba(178, 44, 87, 0.06) !important;
  color: #b22c57 !important;
  border: 1px solid transparent !important;
}
.notify-invite .action-link-left span {
  color: #b22c57 !important;
}
.notify-invite svg {
  stroke: #b22c57 !important;
}
.invite-count {
  background: #b22c57 !important;
  color: #ffffff !important;
  padding: 2px 9px !important;
  border-radius: 12px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
}
.welcome-events-label {
  font-size: 10px;
  color: #9aa3b2;
}
.welcome-event-title {
  font-size: 13px;
  color: #4a5568;
  font-weight: 500;
}
.welcome-event-date {
  font-size: 13px;
  font-weight: 400;
  color: #9aa3b2;
}
.welcome-event-sep {
  color: #c4cbd6 !important;
}
.inbox-flag {
  fill: #6b7280 !important;
  stroke: #6b7280 !important;
}
.inbox-link {
  color: #4a5568;
}
.promo-card,
.lender-highlight-card {
  border: 2px solid #ffffff !important;
  box-shadow: 0 1px 3px rgba(20, 30, 60, 0.04);
  border-radius: 12px;
  overflow: hidden;
}
.section-divider {
  opacity: 0.35;
}
.stat-value {
  font-weight: 600;
}

/* Collapsible "Recent ..." sections (native <details>/<summary>) */
.recent-section {
  margin-bottom: 0;
}
/* Section title inside the summary is a link to the "view all" page.
   Clicking it navigates (links inside <summary> don't toggle); the
   chevron/rest of the header keeps the expand/collapse behaviour. */
.section-label-link {
  color: inherit;
  text-decoration: none;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.section-label-link-icon {
  flex-shrink: 0;
  opacity: 0.7;
}
.section-label-link:hover {
  color: #3759a6;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.recent-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.recent-section > summary::-webkit-details-marker {
  display: none;
}
.recent-section > summary::marker {
  content: "";
}
.recent-toggle-chevron {
  width: 22px;
  height: 22px;
  padding: 4px;
  box-sizing: border-box;
  color: #4a5568;
  background: #ffffff;
  border: 1px solid #d8dde6;
  border-radius: 999px;
  transition: transform 0.18s ease, background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
  margin-left: 8px;
}
.recent-section > summary:hover .recent-toggle-chevron {
  background: #f5f6f8;
  border-color: #b9c1cf;
}
.recent-section[open] > summary > .recent-toggle-chevron {
  transform: rotate(-180deg);
}

/* Full-width "KB Upcoming Events" strip below the dashboard grid */
.events-strip {
  margin-top: 16px;
  padding: 10px 4px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-height: 0;
  height: 52px;
  box-sizing: border-box;
}
.events-strip-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: #636b7f;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.events-strip-viewport {
  flex: 1;
  min-width: 0;
  height: 22px;
  position: relative;
  overflow: hidden;
}
.events-strip-row {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  white-space: nowrap;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.events-strip-row.is-leaving {
  opacity: 0;
  transform: translateY(-10px);
}
.events-strip-row.is-entering {
  opacity: 0;
  transform: translateY(10px);
  transition: none;
}
.events-strip-date {
  font-size: 14px;
  font-weight: 500;
  color: #8b93a3;
  flex-shrink: 0;
}
.events-strip-title {
  font-size: 14px;
  color: #4a5568;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.events-strip-title:hover { color: #3759a6; }
.events-strip-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.events-strip-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #d8dde6;
  transition: background 0.2s ease, transform 0.2s ease;
  cursor: pointer;
  border: none;
  padding: 0;
}
.events-strip-dot.is-active {
  background: #3759a6;
  transform: scale(1.25);
}
.events-strip-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: #3759a6;
  text-decoration: none;
  flex-shrink: 0;
}
.events-strip-link:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .events-strip { flex-wrap: wrap; gap: 12px; }
  .events-strip-viewport { flex-basis: 100%; order: 2; }
}

/* Account / Profile page */
.account-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.account-card {
  background: #ffffff;
  border: 1px solid #e9ecf1;
  border-radius: 12px;
  padding: 40px 28px 24px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.account-card-header {
  margin-bottom: 20px;
}
.account-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #1c2333;
  margin: 0 0 4px 0;
}
.account-card-sub {
  font-size: 13px;
  color: #8b93a3;
  margin: 0;
}
.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.account-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.account-field-wide {
  grid-column: 1 / -1;
}
.account-field label {
  font-size: 12px;
  font-weight: 600;
  color: #636b7f;
  letter-spacing: 0.02em;
}
.account-field input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d9dde4;
  border-radius: 8px;
  background: #ffffff;
  font-size: 14px;
  color: #1c2333;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.account-field input:hover {
  border-color: #b9bfc9;
}
.account-field input:focus {
  border-color: #3759a6;
  box-shadow: 0 0 0 3px rgba(55, 89, 166, 0.12);
}
.account-field input[readonly] {
  background: #f5f6f8;
  color: #636b7f;
  cursor: not-allowed;
}
.account-field input[readonly]:hover,
.account-field input[readonly]:focus {
  border-color: #d9dde4;
  box-shadow: none;
}
.account-field-locked {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef0f3;
  color: #8b93a3;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.account-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}
.account-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 30px;
}
.account-nav-title {
  font-size: 14px;
  font-weight: 600;
  color: #1c2333;
  margin: 0 0 12px 12px;
  letter-spacing: 0.01em;
}
.account-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #636b7f;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.account-nav-link svg {
  flex-shrink: 0;
  color: #8b93a3;
  transition: color 0.15s;
}
.account-nav-link:hover {
  background: #f3f5f8;
  color: #1c2333;
}
.account-nav-link:hover svg {
  color: #636b7f;
}
.account-nav-link-active {
  background: color-mix(in srgb, #3759a6 8%, #ffffff);
  color: #3759a6;
}
.account-nav-link-active svg {
  color: #3759a6;
}
.account-nav-link-active:hover {
  background: color-mix(in srgb, #3759a6 12%, #ffffff);
  color: #3759a6;
}
.account-nav-link-active:hover svg {
  color: #3759a6;
}
.account-content {
  min-width: 0;
}
.account-section {
  scroll-margin-top: 24px;
}
.account-section + .account-section {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid #eef0f3;
}
.account-checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.account-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e9ecf1;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.account-checkbox:hover {
  border-color: #c5cbd6;
  background: #fafbfc;
}
.account-checkbox input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.account-checkbox-box {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid #c5cbd6;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.account-checkbox input:checked + .account-checkbox-box {
  background: #3759a6;
  border-color: #3759a6;
  color: #ffffff;
}
.account-checkbox:has(input:checked) {
  border-color: #3759a6;
  background: color-mix(in srgb, #3759a6 6%, #ffffff);
}
.account-checkbox-label {
  font-size: 14px;
  color: #1c2333;
  font-weight: 500;
}
.account-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #eef0f3;
}
.account-btn-primary {
  background: #3759a6;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.account-btn-primary:hover {
  background: #2f4e8f;
}
.messages-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.compose-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #636b7f;
  text-decoration: none;
  margin-bottom: 8px;
}
.compose-back:hover { color: #3759a6; }
.compose-select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d9dde4;
  border-radius: 8px;
  background: #ffffff;
  font-size: 14px;
  color: #1c2333;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23636b7f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.compose-select:hover { border-color: #b9bfc9; }
.compose-select:focus { border-color: #3759a6; box-shadow: 0 0 0 3px rgba(55, 89, 166, 0.12); }
.compose-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d9dde4;
  border-radius: 8px;
  background: #ffffff;
  font-size: 14px;
  color: #1c2333;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.compose-textarea:hover { border-color: #b9bfc9; }
.compose-textarea:focus { border-color: #3759a6; box-shadow: 0 0 0 3px rgba(55, 89, 166, 0.12); }
.compose-field-hint {
  font-weight: 400;
  font-size: 11px;
  color: #8b93a3;
  margin-left: 6px;
  letter-spacing: 0;
  text-transform: none;
}
.compose-field-error {
  font-size: 12px;
  color: #b22c57;
  margin-top: 4px;
}
.compose-checkbox { padding: 4px 0; }
.compose-btn-cancel {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #636b7f;
  background: transparent;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.compose-btn-cancel:hover { background: #f3f5f8; color: #1c2333; }
.compose-error-banner {
  background: color-mix(in srgb, #b22c57 8%, #ffffff);
  color: #8d1f43;
  border-color: color-mix(in srgb, #b22c57 25%, transparent);
}
.account-saved-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, #199619 10%, #ffffff);
  color: #156915;
  border: 1px solid color-mix(in srgb, #199619 25%, transparent);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}
@media (max-width: 900px) {
  .account-layout { grid-template-columns: 1fr; gap: 20px; }
  .account-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .account-nav-link { padding: 8px 12px; }
}
@media (max-width: 700px) {
  .account-grid,
  .account-checkbox-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Dark mode — applied via [data-theme="dark"] on <html>
   Overrides major surfaces, text, borders. Brand colors retained.
   ============================================================ */
[data-theme="dark"] body {
  background: linear-gradient(to bottom, #1a1f27 0, #0f1216 60px) no-repeat #0f1216;
  color: #e6e9ef;
}
[data-theme="dark"] .header { background: transparent; }
[data-theme="dark"] .nav-link { color: #a0a7b6; }
[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .user-menu-btn:hover,
[data-theme="dark"] .dropdown-item:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .user-menu-btn { color: #e6e9ef; }
[data-theme="dark"] .user-menu-btn svg,
[data-theme="dark"] .dropdown-item svg { color: #a0a7b6; }

/* Dropdowns */
[data-theme="dark"] .dropdown-menu {
  background: #1a1f27;
  border-color: #2a313c;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .dropdown-divider { background: #2a313c; }
[data-theme="dark"] .dropdown-item { color: #e6e9ef; }
[data-theme="dark"] .dropdown-name { color: #e6e9ef; }
[data-theme="dark"] .dropdown-email { color: #a0a7b6; }

/* Headings & text */
[data-theme="dark"] .welcome-title,
[data-theme="dark"] .welcome-back,
[data-theme="dark"] .recent-item-title,
[data-theme="dark"] .messages-list-header,
[data-theme="dark"] .message-row-sender,
[data-theme="dark"] .message-row-subject,
[data-theme="dark"] .message-detail-subject,
[data-theme="dark"] .message-detail-sender,
[data-theme="dark"] .messages-sidebar-item,
[data-theme="dark"] .messages-tab:hover,
[data-theme="dark"] .footer-column-title,
[data-theme="dark"] .account-card-title,
[data-theme="dark"] .account-checkbox-label,
[data-theme="dark"] .account-nav-title { color: #e6e9ef; }

[data-theme="dark"] .messages-tab { color: #7a8190; }
[data-theme="dark"] .events-strip-title,
[data-theme="dark"] .welcome-event-title,
[data-theme="dark"] .inbox-link,
[data-theme="dark"] .inbox-link span,
[data-theme="dark"] .inbox-link svg,
[data-theme="dark"] .stat-link-text,
[data-theme="dark"] .stat-link-left,
[data-theme="dark"] .recent-item-meta,
[data-theme="dark"] .recent-item-chevron,
[data-theme="dark"] .section-label,
[data-theme="dark"] .events-strip-label,
[data-theme="dark"] .footer-link,
[data-theme="dark"] .footer-description,
[data-theme="dark"] .footer-social-link,
[data-theme="dark"] .account-field label,
[data-theme="dark"] .account-nav-link { color: #a0a7b6; }

[data-theme="dark"] .welcome-events-label,
[data-theme="dark"] .welcome-event-date,
[data-theme="dark"] .welcome-event-sep,
[data-theme="dark"] .events-strip-date,
[data-theme="dark"] .messages-empty-list,
[data-theme="dark"] .messages-sidebar-label,
[data-theme="dark"] .message-row-time,
[data-theme="dark"] .message-row-preview,
[data-theme="dark"] .message-detail-time,
[data-theme="dark"] .message-detail-empty,
[data-theme="dark"] .message-detail-empty span,
[data-theme="dark"] .footer-copyright,
[data-theme="dark"] .account-card-sub { color: #7a8190; }

[data-theme="dark"] .footer-link:hover,
[data-theme="dark"] .footer-social-link:hover { color: #e6e9ef; background: rgba(255,255,255,0.06); }

/* Cards & panels */
[data-theme="dark"] .card { background: #1a1f27; border-color: #2a313c !important; box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
[data-theme="dark"] .criteria-card { background: linear-gradient(to bottom, rgba(55, 89, 166, 0.18) 0%, #1a1f27 50px); }
[data-theme="dark"] .affcalc-card { background: linear-gradient(to bottom, rgba(25, 150, 25, 0.18) 0%, #1a1f27 50px); }
[data-theme="dark"] .notify-card { background: linear-gradient(to bottom, rgba(178, 44, 87, 0.22) 0%, #1a1f27 50px); }
[data-theme="dark"] .card-title { color: #e6e9ef !important; }
[data-theme="dark"] .stat-link { background: transparent; }
[data-theme="dark"] .stat-link:hover,
[data-theme="dark"] .recent-item:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .promo-card,
[data-theme="dark"] .lender-highlight-card { border-color: #2a313c !important; }

/* Action chips on dashboard cards in dark */
[data-theme="dark"] .action-link.criteria-action { background: rgba(55, 89, 166, 0.18); }
[data-theme="dark"] .action-link.criteria-action:hover { background: rgba(55, 89, 166, 0.28); }
[data-theme="dark"] .action-link.affcalc-action { background: rgba(25, 150, 25, 0.18); }
[data-theme="dark"] .action-link.affcalc-action:hover { background: rgba(25, 150, 25, 0.28); }
[data-theme="dark"] .action-link.notify-action { background: rgba(178, 44, 87, 0.18); }
[data-theme="dark"] .action-link.notify-action:hover { background: rgba(178, 44, 87, 0.28); }
[data-theme="dark"] .notify-invite { background: rgba(178, 44, 87, 0.18) !important; }

/* Messages page */
[data-theme="dark"] .messages-layout {
  background: #1a1f27;
  border-color: #2a313c;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
[data-theme="dark"] .messages-list { background: #14181f; }
[data-theme="dark"] .messages-list-count,
[data-theme="dark"] .messages-sidebar-count,
[data-theme="dark"] .account-field-locked { background: #2a313c; color: #a0a7b6; }
[data-theme="dark"] .messages-tab:not(.is-active) .messages-tab-count { background: #2a313c; color: #a0a7b6; }
[data-theme="dark"] .messages-tool-btn { color: #a0a7b6; }
[data-theme="dark"] .messages-tool-btn:hover { background: rgba(255,255,255,0.06); color: #e6e9ef; }
[data-theme="dark"] .messages-sidebar-item:hover { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .messages-sidebar-icon { color: #a0a7b6; }
[data-theme="dark"] .message-row { border-bottom-color: #232932; color: #e6e9ef; }
[data-theme="dark"] .message-row:hover,
[data-theme="dark"] .message-row.is-active { background: rgba(255,255,255,0.04); }
[data-theme="dark"] .message-detail { background: #1a1f27; }
[data-theme="dark"] .message-detail-empty svg { color: #2a313c; }
[data-theme="dark"] .message-detail-empty p { color: #a0a7b6; }
[data-theme="dark"] .message-detail-header { border-bottom-color: #232932; }
[data-theme="dark"] .message-detail-body { color: #d2d7e0; }
[data-theme="dark"] .message-detail-delete { background: #1a1f27; border-color: #4a1d2e; }
[data-theme="dark"] .message-detail-delete:hover { background: #2a1018; border-color: #6a2940; }

/* Account page */
[data-theme="dark"] .account-card {
  background: #1a1f27;
  border-color: #2a313c;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
[data-theme="dark"] .account-section + .account-section,
[data-theme="dark"] .account-actions { border-top-color: #232932; }
[data-theme="dark"] .account-field input {
  background: #232932;
  border-color: #313945;
  color: #e6e9ef;
}
[data-theme="dark"] .account-field input:hover { border-color: #424c5c; }
[data-theme="dark"] .account-field input[readonly] { background: #14181f; color: #7a8190; }
[data-theme="dark"] .account-field input[readonly]:hover { border-color: #313945; }
[data-theme="dark"] .account-checkbox {
  background: #232932;
  border-color: #2a313c;
}
[data-theme="dark"] .account-checkbox:hover { background: #2a313c; border-color: #424c5c; }
[data-theme="dark"] .account-checkbox-box { background: #14181f; border-color: #424c5c; }
[data-theme="dark"] .account-checkbox:has(input:checked) { background: rgba(55, 89, 166, 0.18); border-color: #3759a6; }
[data-theme="dark"] .account-nav-link:hover { background: rgba(255,255,255,0.06); color: #e6e9ef; }
[data-theme="dark"] .account-nav-link:hover svg { color: #c5cbd6; }
[data-theme="dark"] .account-nav-link-active,
[data-theme="dark"] .account-nav-link-active:hover { background: rgba(55, 89, 166, 0.22); color: #94b0e6; }
[data-theme="dark"] .account-nav-link-active svg,
[data-theme="dark"] .account-nav-link-active:hover svg { color: #94b0e6; }
[data-theme="dark"] .account-saved-banner {
  background: rgba(25, 150, 25, 0.18);
  color: #6dd66d;
  border-color: rgba(25, 150, 25, 0.45);
}

/* Footer */
[data-theme="dark"] .footer { background: #14181f; }
[data-theme="dark"] .footer-divider { background: #2a313c; }

/* Events strip dots */
[data-theme="dark"] .events-strip-dot { background: #2a313c; }

/* Dropdown theme toggle row */
.dropdown-theme-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 6px;
  color: #1c2333;
  cursor: pointer;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  font-family: inherit;
  transition: background 0.15s;
}
.dropdown-theme-toggle:hover { background: rgba(0,0,0,0.04); }
.dropdown-theme-toggle svg { color: #636b7f; flex-shrink: 0; }
.dropdown-theme-toggle-label { flex: 1; }
.dropdown-theme-toggle-state { font-size: 12px; color: #8b93a3; font-weight: 500; }
[data-theme="dark"] .dropdown-theme-toggle { color: #e6e9ef; }
[data-theme="dark"] .dropdown-theme-toggle:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .dropdown-theme-toggle svg { color: #a0a7b6; }
[data-theme="dark"] .dropdown-theme-toggle-state { color: #7a8190; }

[data-theme="dark"] .recent-toggle-chevron {
  background: #232932;
  border-color: #313945;
  color: #a0a7b6;
}
[data-theme="dark"] .recent-section > summary:hover .recent-toggle-chevron {
  background: #2a313c;
  border-color: #424c5c;
}

.stat-link-chevron { color: #8b93a3; flex-shrink: 0; }
[data-theme="dark"] .stat-link-chevron { color: #7a8190; }

.recent-item-meta-lg { font-size: 12px; }

.recent-item-date { color: #a8b0bd; font-weight: 400; }
[data-theme="dark"] .recent-item-date { color: #5d6573; }

.recent-item-title-with-icon { display: flex; align-items: center; gap: 6px; }
.recent-item-person { color: #8b93a3; flex-shrink: 0; }
[data-theme="dark"] .recent-item-person { color: #7a8190; }

.user-menu { border-left: 1px solid #e2e5eb; padding-left: 16px; margin-left: 4px; }
[data-theme="dark"] .user-menu { border-left-color: #3a4150; }

.has-tooltip { position: relative; }
.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #2a2f3a;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: normal;
  width: max-content;
  max-width: 240px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.has-tooltip::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 5px solid transparent;
  border-top-color: #2a2f3a;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 100;
}
.has-tooltip:hover::after,
.has-tooltip:hover::before,
.has-tooltip:focus-visible::after,
.has-tooltip:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  transition-delay: 0.5s;
}

.info-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #a8b0bd;
  cursor: help;
  margin-left: 2px;
  outline: none;
}
.info-tooltip:hover { color: #3759a6; }
[data-theme="dark"] .info-tooltip { color: #6b7382; }
[data-theme="dark"] .info-tooltip:hover { color: #8fa9d9; }
[data-theme="dark"] .has-tooltip::after { background: #e8eaef; color: #1a1d24; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
[data-theme="dark"] .has-tooltip::before { border-top-color: #e8eaef; }

.message-rating {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #ebedf1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
[data-theme="dark"] .message-rating { border-top-color: #2a2f3a; }
.message-rating-label { font-size: 13px; color: #5d6573; }
[data-theme="dark"] .message-rating-label { color: #a8b0bd; }
.message-rating-faces { display: inline-flex; gap: 6px; }
.message-rating-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: #8b93a3;
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  outline: none;
}
.message-rating-face:hover { color: #1a2433; background: #f3f5f9; transform: scale(1.08); }
.message-rating-face.is-selected { color: #3759a6; background: rgba(55, 89, 166, 0.10); }
[data-theme="dark"] .message-rating-face { color: #7a8190; }
[data-theme="dark"] .message-rating-face:hover { color: #e8eaef; background: rgba(255,255,255,0.06); }
[data-theme="dark"] .message-rating-face.is-selected { color: #8fa9d9; background: rgba(143, 169, 217, 0.16); }
.message-rating-thanks { font-size: 12px; color: #199619; }
[data-theme="dark"] .message-rating-thanks { color: #4ec74e; }

.affcalc-recent-item { align-items: flex-start; gap: 12px; }
.affcalc-stage { margin: 0 0 2px 0; font-size: 9px; font-weight: 400; color: #8b93a3; letter-spacing: 0.3px; text-transform: uppercase; }
[data-theme="dark"] .affcalc-stage { color: #7a8190; }
.affcalc-recent-item .recent-item-title { margin: 0 0 2px 0; }
.affcalc-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.affcalc-meta-row .recent-item-meta { margin: 0; font-size: 12px; line-height: 1.3; display: inline-flex; align-items: center; gap: 8px; }
.affcalc-inline-actions { display: inline-flex; gap: 14px; flex-shrink: 0; align-items: center; }
.affcalc-lozenge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(25, 150, 25, 0.10);
  color: #199619;
  letter-spacing: 0.2px;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .affcalc-lozenge { background: rgba(78, 199, 78, 0.16); color: #4ec74e; }
.affcalc-lozenge-warn { background: rgba(178, 44, 87, 0.10); color: #b22c57; }
[data-theme="dark"] .affcalc-lozenge-warn { background: rgba(232, 110, 152, 0.16); color: #e86e98; }
.affcalc-status-icon { flex-shrink: 0; vertical-align: middle; }
.affcalc-status-ok { color: #199619; }
.affcalc-status-warn { color: #b22c57; }
[data-theme="dark"] .affcalc-status-ok { color: #4ec74e; }
[data-theme="dark"] .affcalc-status-warn { color: #e86e98; }
.affcalc-inline-link {
  font-size: 12px; line-height: 1.3; font-weight: 600; color: #199619;
  text-decoration: none;
}
.affcalc-inline-link:hover { text-decoration: underline; }
[data-theme="dark"] .affcalc-inline-link { color: #4ec74e; }

/* Watchlist page */
.welcome-subtitle { color: #5d6573; font-size: 14px; margin: 4px 0 0 0; }
[data-theme="dark"] .welcome-subtitle { color: #a8b0bd; }

.watchlist-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.watchlist-table thead th {
  text-align: left; font-size: 11px; font-weight: 600;
  color: #5d6573; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 12px 20px;
  background: #f7f8fa;
  border-bottom: 1px solid #e2e5eb;
  border-right: 1px solid #e2e5eb;
}
.watchlist-table thead th:last-child { border-right: none; }
.watchlist-table tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid #eef0f4;
  border-right: 1px solid #eef0f4;
  vertical-align: top; color: #2a2f3a;
}
.watchlist-table tbody td:last-child { border-right: none; }
.watchlist-table tbody tr:last-child td { border-bottom: none; }
.watchlist-cell-criteria { min-width: 220px; }
.watchlist-cell-title { display: block; font-weight: 600; color: #1a1d24; }
.watchlist-cell-category { display: block; font-size: 12px; color: #5d6573; margin-top: 2px; }
.watchlist-cell-date { white-space: nowrap; color: #5d6573; width: 1%; }
.watchlist-cell-changes { min-width: 320px; }
.watchlist-no-changes { color: #8b93a3; font-style: italic; }

.watchlist-changes-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.watchlist-change-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.watchlist-change-row + .watchlist-change-row { padding-top: 6px; border-top: 1px dashed #e2e5eb; }
.watchlist-change-lender-link {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: #2a2f3a; min-width: 0;
}
.watchlist-change-lender-link:hover .watchlist-change-lender { text-decoration: underline; color: #3759a6; }
.watchlist-lender-logo {
  width: 86px; height: 30px; border-radius: 4px; flex-shrink: 0;
  background: #eef0f4; color: #5d6573;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  border: 1px solid #e2e5eb;
}
.watchlist-change-lender { font-weight: 600; color: #2a2f3a; font-size: 13px; }
.watchlist-change-when { font-size: 11px; color: #8b93a3; white-space: nowrap; flex-shrink: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.watchlist-th-action { width: 56px; text-align: center; }
.watchlist-cell-action { width: 56px; text-align: center; vertical-align: middle; padding: 14px 12px; }
.watchlist-cell-action form { margin: 0; display: inline-flex; }
.watchlist-remove-btn {
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid #d4d8e0; border-radius: 4px;
  color: #8b93a3; cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.watchlist-remove-btn:hover { color: #2a2f3a; border-color: #a8b0bd; background: #f7f8fa; }
[data-theme="dark"] .watchlist-remove-btn { background: transparent; border-color: #3a4150; color: #7a8190; }
[data-theme="dark"] .watchlist-remove-btn:hover { color: #e8eaef; border-color: #5a6170; background: #2f3543; }

.kb-dialog {
  position: fixed; inset: 0; margin: auto;
  border: 1px solid #e2e5eb; border-radius: 8px; padding: 0;
  width: min(440px, calc(100% - 32px)); height: fit-content;
  background: #fff; color: #2a2f3a;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}
.kb-dialog::backdrop { background: transparent; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.kb-dialog form { padding: 24px; margin: 0; }
.kb-dialog-title { margin: 0 0 8px 0; font-size: 16px; font-weight: 700; color: #1a1d24; }
.kb-dialog-body { margin: 0 0 20px 0; font-size: 13px; line-height: 1.5; color: #5d6573; }
.kb-dialog-body strong { color: #1a1d24; font-weight: 600; }
.kb-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.kb-dialog-btn {
  padding: 8px 16px; font-size: 13px; font-weight: 600; border-radius: 4px;
  border: 1px solid transparent; cursor: pointer; font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.kb-dialog-btn-secondary { background: #fff; border-color: #d4d8e0; color: #2a2f3a; }
.kb-dialog-btn-secondary:hover { background: #f7f8fa; border-color: #a8b0bd; }
.kb-dialog-btn-danger { background: #b22c57; color: #fff; }
.kb-dialog-btn-danger:hover { background: #951f47; }

[data-theme="dark"] .kb-dialog { background: #1f232c; color: #e8eaef; border-color: #3a4150; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .kb-dialog::backdrop { background: transparent; }
[data-theme="dark"] .kb-dialog-title { color: #e8eaef; }
[data-theme="dark"] .kb-dialog-body { color: #a8b0bd; }
[data-theme="dark"] .kb-dialog-body strong { color: #e8eaef; }
[data-theme="dark"] .kb-dialog-btn-secondary { background: #2f3543; border-color: #3a4150; color: #e8eaef; }
[data-theme="dark"] .kb-dialog-btn-secondary:hover { background: #3a4150; border-color: #5a6170; }

[data-theme="dark"] .watchlist-table thead th { background: #1f232c; color: #a8b0bd; border-bottom-color: #3a4150; border-right-color: #3a4150; }
[data-theme="dark"] .watchlist-table tbody td { color: #e8eaef; border-bottom-color: #2f3543; border-right-color: #2f3543; }
[data-theme="dark"] .watchlist-cell-title { color: #e8eaef; }
[data-theme="dark"] .watchlist-cell-category,
[data-theme="dark"] .watchlist-cell-date { color: #a8b0bd; }
[data-theme="dark"] .watchlist-no-changes { color: #7a8190; }
[data-theme="dark"] .watchlist-change-row + .watchlist-change-row { border-top-color: #2f3543; }
[data-theme="dark"] .watchlist-change-lender-link { color: #e8eaef; }
[data-theme="dark"] .watchlist-change-lender-link:hover .watchlist-change-lender { color: #8fa9d9; }
[data-theme="dark"] .watchlist-change-lender { color: #e8eaef; }
[data-theme="dark"] .watchlist-change-when { color: #7a8190; }
[data-theme="dark"] .watchlist-lender-logo { background: #2f3543; color: #a8b0bd; border-color: #3a4150; }

.watchlist-summary { display: flex; gap: 12px; margin-bottom: 20px; }
.watchlist-summary-card {
  display: flex; flex-direction: column; align-items: flex-start;
  background: #fff; border: 1px solid #e2e5eb; border-radius: 8px;
  padding: 14px 18px; min-width: 140px;
}
.watchlist-summary-number { font-size: 24px; font-weight: 700; color: #3759a6; line-height: 1.1; }
.watchlist-summary-changed { color: #b22c57; }
.watchlist-summary-label { font-size: 12px; color: #5d6573; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
[data-theme="dark"] .watchlist-summary-card { background: #232732; border-color: #3a4150; }
[data-theme="dark"] .watchlist-summary-number { color: #8fa9d9; }
[data-theme="dark"] .watchlist-summary-changed { color: #e26b8e; }
[data-theme="dark"] .watchlist-summary-label { color: #a8b0bd; }

.watchlist-card { background: #fff; border: 1px solid #e2e5eb; border-radius: 8px; overflow: hidden; }
[data-theme="dark"] .watchlist-card { background: #232732; border-color: #3a4150; }

.watchlist-list { list-style: none; padding: 0; margin: 0; }
.watchlist-item {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 16px 20px;
  border-bottom: 1px solid #eef0f4;
}
.watchlist-item:last-child { border-bottom: none; }
[data-theme="dark"] .watchlist-item { border-bottom-color: #2f3543; }

.watchlist-item-main { flex: 1; min-width: 0; }
.watchlist-item-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.watchlist-item-title { font-size: 15px; font-weight: 600; color: #1a1d24; margin: 0; }
[data-theme="dark"] .watchlist-item-title { color: #e8eaef; }

.watchlist-badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; text-transform: uppercase; letter-spacing: 0.4px;
}
.watchlist-badge-changed { background: rgba(178,44,87,0.1); color: #b22c57; }
[data-theme="dark"] .watchlist-badge-changed { background: rgba(226,107,142,0.15); color: #e26b8e; }

.watchlist-item-meta {
  font-size: 12px; color: #5d6573; margin: 6px 0 0 0;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.watchlist-item-lender { font-weight: 600; color: #3759a6; }
[data-theme="dark"] .watchlist-item-lender { color: #8fa9d9; }
[data-theme="dark"] .watchlist-item-meta { color: #a8b0bd; }
.watchlist-meta-sep { color: #c2c8d2; }
[data-theme="dark"] .watchlist-meta-sep { color: #4a5161; }
.watchlist-changed-ago { color: #b22c57; font-weight: 600; }
[data-theme="dark"] .watchlist-changed-ago { color: #e26b8e; }

.watchlist-change-note {
  margin: 8px 0 0 0; padding: 8px 12px;
  background: rgba(178,44,87,0.06); border-left: 3px solid #b22c57;
  font-size: 13px; color: #3a3d45; border-radius: 0 4px 4px 0;
}
[data-theme="dark"] .watchlist-change-note { background: rgba(226,107,142,0.08); color: #d4d7df; border-left-color: #e26b8e; }

.watchlist-item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.watchlist-action-link { font-size: 13px; font-weight: 600; color: #3759a6; text-decoration: none; }
.watchlist-action-link:hover { text-decoration: underline; }
[data-theme="dark"] .watchlist-action-link { color: #8fa9d9; }

.watchlist-remove-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  font-size: 12px; font-weight: 500; color: #8b93a3;
  padding: 4px 0;
}
.watchlist-remove-btn:hover { color: #b22c57; }
[data-theme="dark"] .watchlist-remove-btn { color: #7a8190; }
[data-theme="dark"] .watchlist-remove-btn:hover { color: #e26b8e; }

.watchlist-empty { padding: 40px 20px; text-align: center; color: #5d6573; }
.watchlist-empty-link { display: inline-block; margin-top: 8px; color: #3759a6; font-weight: 600; text-decoration: none; }
.watchlist-empty-link:hover { text-decoration: underline; }

/* ==========================================================================
   Login page
   ========================================================================== */
.login-body {
  margin: 0;
  font-family: 'Open Sans', sans-serif;
  background: #f4f6fa;
  color: #1a1d24;
  min-height: 100vh;
}
[data-theme="dark"] .login-body { background: #15181f; color: #e8eaef; }

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  gap: 14px;
}

.login-shell {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 1100px;
  min-height: 540px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(20, 28, 48, 0.08);
  padding: 16px;
  gap: 16px;
  box-sizing: border-box;
}
[data-theme="dark"] .login-shell { background: #1f232c; box-shadow: 0 12px 40px rgba(0,0,0,0.4); }

.login-advert {
  flex: 1 1 50%;
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(135deg, #3759a6 0%, #2c4884 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  order: 2;
  margin: 36px 40px 28px 0;
}
@media (max-width: 900px) {
  .login-advert { margin: 0; }
}

.login-advert-placeholder {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.85);
  font-size: 15px;
  text-align: center;
  padding: 24px;
}
.login-advert-placeholder-label { font-weight: 600; letter-spacing: 0.02em; }
.login-advert-placeholder-dim { font-size: 13px; color: rgba(255,255,255,0.6); }

@media (max-width: 900px) {
  .login-page { padding: 0; align-items: stretch; }
  .login-shell { flex-direction: column; min-height: 100vh; border-radius: 0; box-shadow: none; max-width: none; padding: 16px; gap: 16px; }
  .login-advert { display: none; }
}

.login-advert-track {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  will-change: transform;
}
.login-advert-track.is-sliding {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(-100%);
}
.login-advert-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: block;
}
.login-advert-slide > a,
.login-advert-slide > div {
  display: block;
  width: 100%;
  height: 100%;
}
.login-advert-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.login-card {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 36px 40px 28px;
  box-sizing: border-box;
  order: 1;
}
.login-card > * { width: 100%; max-width: 360px; }
@media (max-width: 900px) {
  .login-card { padding: 20px 16px 12px; }
}

.login-brand { display: flex; justify-content: flex-start; margin-bottom: 18px; }
.login-logo { height: 44px; width: auto; }

.login-tabs {
  display: inline-flex;
  width: auto;
  max-width: max-content;
  background: #f1f3f7;
  border-radius: 10px;
  padding: 3px;
  margin: 0 0 16px;
  gap: 4px;
}
[data-theme="dark"] .login-tabs { background: #2a2f3a; }
.login-tab {
  appearance: none;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #5d6573;
  padding: 8px 16px;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 120ms ease, color 120ms ease;
}
[data-theme="dark"] .login-tab { color: #a8b0bd; }
.login-tab:hover { color: #2a2f3a; }
[data-theme="dark"] .login-tab:hover { color: #e8eaef; }
.login-tab.is-active {
  background: #fff;
  color: #2a2f3a;
  box-shadow: 0 1px 3px rgba(20,28,48,0.08);
}
[data-theme="dark"] .login-tab.is-active { background: #1f232c; color: #e8eaef; box-shadow: 0 1px 3px rgba(0,0,0,0.4); }

.login-panels {
  display: grid;
  grid-template-columns: 1fr;
}
.login-panels > .login-panel {
  grid-row: 1;
  grid-column: 1;
  align-self: start;
}
.login-panel[hidden] {
  visibility: hidden;
  pointer-events: none;
}
.login-magic-success[hidden],
#magicForm[hidden] { display: none !important; }
.login-helper { margin: 4px 0 0; font-size: 12px; color: #7a808d; line-height: 1.5; }
[data-theme="dark"] .login-helper { color: #a8b0bd; }

.login-magic-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 0 4px;
  gap: 12px;
}
.login-magic-success-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(55, 89, 166, 0.1);
  color: #3759a6;
  border-radius: 50%;
}
.login-magic-success-icon svg { width: 32px; height: 32px; display: block; }
[data-theme="dark"] .login-magic-success-icon { background: rgba(55, 89, 166, 0.2); color: #8da7d6; }
.login-magic-success-title { font-size: 16px; font-weight: 700; margin: 4px 0 0; color: #2a2f3a; }
[data-theme="dark"] .login-magic-success-title { color: #e8eaef; }
.login-magic-success-text { font-size: 13px; color: #5d6573; margin: 0; line-height: 1.5; }
[data-theme="dark"] .login-magic-success-text { color: #a8b0bd; }
.login-magic-success-text strong { color: #2a2f3a; font-weight: 600; }
[data-theme="dark"] .login-magic-success-text strong { color: #e8eaef; }
.login-magic-resend {
  background: none; border: 0; padding: 0; margin-top: 4px;
  font: inherit; font-size: 13px; font-weight: 600; color: #3759a6;
  cursor: pointer; text-decoration: underline;
}
.login-magic-resend:disabled { color: #7a808d; cursor: default; text-decoration: none; }

.login-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; text-align: left; }
.login-subtitle { font-size: 13px; color: #5d6573; margin: 0 0 18px; text-align: left; }
[data-theme="dark"] .login-subtitle { color: #a8b0bd; }

.login-alert {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.login-alert-error { background: #fdecef; color: #b22c57; border: 1px solid #f5c8d3; }
.login-alert-info { background: #eef3fb; color: #3759a6; border: 1px solid #d3deef; }
[data-theme="dark"] .login-alert-error { background: #3a1d27; color: #f29ab1; border-color: #5a2a38; }
[data-theme="dark"] .login-alert-info { background: #1d2a3f; color: #8fa9d9; border-color: #2c4063; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-label { font-size: 13px; font-weight: 600; color: #3a4150; }
[data-theme="dark"] .login-label { color: #c8cdd8; }

.login-field input[type="text"],
.login-field input[type="email"],
.login-field input[type="password"] {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid #d6dae3;
  border-radius: 8px;
  background: #fff;
  color: #1a1d24;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.login-field input:focus { border-color: #3759a6; }
[data-theme="dark"] .login-field input { background: #15181f; color: #e8eaef; border-color: #353b48; }
[data-theme="dark"] .login-field input:focus { border-color: #6f8fcf; }

.login-input-wrap { position: relative; }
.login-input-wrap input { padding-right: 60px; }
.login-show-pw {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #3759a6;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
}
.login-show-pw:hover { background: #eef3fb; }
[data-theme="dark"] .login-show-pw { color: #8fa9d9; }
[data-theme="dark"] .login-show-pw:hover { background: #1d2a3f; }

.login-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #3a4150;
  cursor: pointer;
}
.login-remember input { width: 16px; height: 16px; accent-color: #3759a6; cursor: pointer; }
[data-theme="dark"] .login-remember { color: #c8cdd8; }

.login-link { font-size: 13px; color: #3759a6; text-decoration: none; font-weight: 600; }
.login-link:hover { text-decoration: underline; }
[data-theme="dark"] .login-link { color: #8fa9d9; }

.login-submit {
  margin-top: 2px;
  background: #3759a6;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.login-submit:hover { background: #2c4884; }

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: #8b93a3;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e6e8ee;
}
[data-theme="dark"] .login-divider::before,
[data-theme="dark"] .login-divider::after { background: #2a2f3a; }

.login-trial {
  display: block;
  text-align: center;
  padding: 10px 16px;
  border: 1px solid #3759a6;
  color: #3759a6;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}
.login-trial:hover { background: #eef3fb; }
[data-theme="dark"] .login-trial { color: #8fa9d9; border-color: #6f8fcf; }
[data-theme="dark"] .login-trial:hover { background: #1d2a3f; }

.login-legal {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
}
.login-legal a {
  font-size: 12px;
  color: #5d6573;
  text-decoration: none;
}
.login-legal a:hover { color: #3759a6; text-decoration: underline; }
[data-theme="dark"] .login-legal a { color: #a8b0bd; }
[data-theme="dark"] .login-legal a:hover { color: #8fa9d9; }

/* Forgot password modal */
.login-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-modal[hidden] { display: none; }
.login-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 28, 48, 0.45);
}
.login-modal-card {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 28px 24px 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  box-sizing: border-box;
}
[data-theme="dark"] .login-modal-card { background: #1f232c; }
.login-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #5d6573;
  cursor: pointer;
  padding: 4px 8px;
}
.login-modal-close:hover { color: #1a1d24; }
[data-theme="dark"] .login-modal-close { color: #a8b0bd; }
[data-theme="dark"] .login-modal-close:hover { color: #fff; }
.login-modal-title { font-size: 18px; font-weight: 700; margin: 0 0 8px; }
.login-modal-text { font-size: 13px; color: #5d6573; margin: 0 0 16px; }
[data-theme="dark"] .login-modal-text { color: #a8b0bd; }

/* ============================================================
   Criteria Search — centered assistant + results table
   ============================================================ */
.cs-page {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 48px 24px 64px;
}
.cs-inner {
  width: 100%;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: max-width 0.25s ease;
}
.cs-page.cs-has-results .cs-inner { max-width: 1400px; }

/* --- Landing hero --- */
.cs-hero {
  text-align: center;
  margin: 6vh 0 30px;
  animation: cs-fade-in 0.4s ease both;
}
.cs-page.cs-has-results .cs-hero { display: none; }

.cs-greeting {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #101828;
  margin: 0;
  line-height: 1.2;
}
.cs-subhead {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #101828;
  margin: 4px 0 0;
  line-height: 1.2;
}
.cs-accent { color: #3759a6; }

@keyframes cs-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Central composer --- */
.cs-composer {
  width: 100%;
  max-width: 720px;
  background: #ffffff;
  border: 1px solid #e7e9ee;
  border-radius: 22px;
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.09);
  padding: 18px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.cs-composer:focus-within { border-color: #c3cddf; box-shadow: 0 18px 52px rgba(55, 89, 166, 0.14); }
.cs-page.cs-has-results { align-items: flex-start; padding-bottom: 300px; }
.cs-page.cs-has-results .cs-composer { max-width: 100%; margin: -20px 0 0; position: relative; z-index: 2; }

/* --- Bottom dock: agent response + command box --- */
.cs-dock {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
}
.cs-page.cs-has-results .cs-dock {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(1400px, calc(100% - 48px));
  max-width: 1400px;
  z-index: 40;
}

/* --- Agent response box (sits just above the command box, slightly narrower) --- */
.cs-response[hidden] { display: none; }
.cs-response {
  position: relative;
  z-index: 1;
  width: calc(100% - 32px);
  max-width: 100%;
  background: #eceef3;
  border-radius: 16px;
  padding: 16px 22px 34px;
  max-height: 46vh;
  overflow-y: auto;
}
.cs-response-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}
.cs-response-spark { color: #7b6cf0; display: inline-flex; }
.cs-response-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #667085;
}
.cs-response-body {
  font-size: 14px;
  line-height: 1.6;
  color: #344054;
}

.cs-composer-top { display: flex; gap: 11px; align-items: flex-start; }
.cs-composer-spark {
  flex: 0 0 auto;
  margin-top: 6px;
  color: #7b6cf0;
}
.cs-input {
  flex: 1 1 auto;
  resize: none;
  border: none;
  background: transparent;
  padding: 6px 0;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: #1d2939;
  min-height: 28px;
  max-height: 220px;
  outline: none;
}
.cs-input::placeholder { color: #98a2b3; }

.cs-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cs-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cs-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: #475467;
  background: #fff;
  border: 1px solid #e4e7ee;
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.cs-chip:hover { background: #f9fafb; border-color: #d0d5dd; }
.cs-chip-icon { padding: 7px; color: #98a2b3; }
.cs-chip-icon:hover { color: #3759a6; }
.cs-chip-active {
  color: #3759a6;
  background: color-mix(in srgb, #3759a6 8%, transparent);
  border-color: color-mix(in srgb, #3759a6 22%, transparent);
}
.cs-send {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border: none;
  border-radius: 50%;
  background: #3759a6;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.cs-send:hover { background: #2c4a8f; }
.cs-send:active { transform: scale(0.94); }

/* --- Results / table --- */
.cs-results[hidden] { display: none; }
.cs-results {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #ffffff;
  border: 1px solid #e7e9ee;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
  overflow: hidden;
  animation: cs-fade-in 0.35s ease both;
}
.cs-results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid #eef0f4;
  flex-wrap: wrap;
}
.cs-results-title { font-size: 18px; font-weight: 700; margin: 0; color: #101828; letter-spacing: -0.01em; }
.cs-results-sub { font-size: 13px; margin: 4px 0 0; color: #667085; }
.cs-results-actions { display: flex; align-items: center; gap: 12px; }
.cs-results-count {
  font-size: 12px;
  font-weight: 600;
  color: #3759a6;
  background: color-mix(in srgb, #3759a6 9%, transparent);
  padding: 6px 12px;
  border-radius: 999px;
}
.cs-ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  color: #475467;
  background: #fff;
  border: 1px solid #d0d5dd;
  border-radius: 9px;
  padding: 8px 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.cs-ghost-btn:hover { background: #f9fafb; color: #3759a6; border-color: #c3cddf; }

.cs-table-wrap { flex: 1 1 auto; overflow: auto; background: #edf0f4; }
.cs-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; font-size: 13.5px; background: #edf0f4; }
.cs-table thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left;
  font-family: "IBM Plex Sans", "Open Sans", sans-serif;
  font-optical-sizing: auto;
  font-variation-settings: "wdth" 75;
  font-size: 15px; font-weight: 700;
  letter-spacing: 0.01em;
  color: #101828;
  background: #ffffff;
  padding: 13px 24px;
  border-bottom: 1px solid #eaecf0;
  white-space: nowrap;
  vertical-align: top;
}
.cs-table tbody td {
  padding: 14px 24px;
  color: #344054;
  vertical-align: top;
}
/* Floating rows with alternating column tints — matches the Criteria Chat table. */
.cs-table tbody td:nth-child(odd) { background: #ffffff; }
.cs-table tbody td:nth-child(even) { background: #fafafa; }
.cs-table tbody tr:hover td { background: #eef1f6; }
.cs-cell-lender { font-weight: 700; color: #101828; white-space: nowrap; }
.cs-col-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: #101828; font-weight: 600; }
.cs-table thead th.cs-col-num { text-align: right; }

.cs-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.cs-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cs-tag-yes { color: #067647; background: #ecfdf3; }
.cs-tag-refer { color: #b54708; background: #fffaeb; }
.cs-tag-no { color: #b42318; background: #fef3f2; }

/* --- Dark mode --- */
[data-theme="dark"] .cs-greeting,
[data-theme="dark"] .cs-subhead { color: #f0f2f6; }
[data-theme="dark"] .cs-accent { color: #93a9e6; }
[data-theme="dark"] .cs-composer,
[data-theme="dark"] .cs-results { background: #141922; border-color: #252b36; }
[data-theme="dark"] .cs-response { background: #1e242f; }
[data-theme="dark"] .cs-response-body { color: #c4cad4; }
[data-theme="dark"] .cs-response-label { color: #98a1b2; }
[data-theme="dark"] .cs-composer { box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4); }
[data-theme="dark"] .cs-input { color: #e6e9ef; }
[data-theme="dark"] .cs-input::placeholder { color: #7d8698; }
[data-theme="dark"] .cs-chip { background: #1b212b; border-color: #2a313c; color: #a8b0bd; }
[data-theme="dark"] .cs-chip:hover { background: #232834; border-color: #3a4453; }
[data-theme="dark"] .cs-chip-icon { color: #7d8698; }
[data-theme="dark"] .cs-results-header { border-color: #232834; }
[data-theme="dark"] .cs-results-title { color: #f0f2f6; }
[data-theme="dark"] .cs-results-sub { color: #98a1b2; }
[data-theme="dark"] .cs-ghost-btn { background: #232834; border-color: #333b48; color: #a8b0bd; }
[data-theme="dark"] .cs-ghost-btn:hover { background: #2a313c; color: #cbd2de; }
[data-theme="dark"] .cs-table-wrap,
[data-theme="dark"] .cs-table { background: #10141c; }
[data-theme="dark"] .cs-table thead th { background: #10141c; color: #f0f3f8; border-color: #232834; }
[data-theme="dark"] .cs-table tbody td { color: #c4cad4; }
[data-theme="dark"] .cs-table tbody td:nth-child(odd) { background: #141922; }
[data-theme="dark"] .cs-table tbody td:nth-child(even) { background: #171d27; }
[data-theme="dark"] .cs-table tbody tr:hover td { background: #1c2330; }
[data-theme="dark"] .cs-cell-lender,
[data-theme="dark"] .cs-col-num { color: #f0f2f6; }
[data-theme="dark"] .cs-tag-yes { color: #6ce9a6; background: rgba(6, 118, 71, 0.18); }
[data-theme="dark"] .cs-tag-refer { color: #fdb022; background: rgba(181, 71, 8, 0.18); }
[data-theme="dark"] .cs-tag-no { color: #fda29b; background: rgba(180, 35, 24, 0.18); }

/* --- Responsive --- */
@media (max-width: 720px) {
  .cs-page { padding: 28px 16px 48px; }
  .cs-greeting, .cs-subhead { font-size: 24px; }
  .cs-hero { margin-top: 3vh; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .cs-hero, .cs-response, .cs-results { animation: none; }
}
