/**
 * SOA UI theme — UI-3 inspired (Smartpro-style)
 * Primary: #1877F2 | Font: DM Sans
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --soa-bg: #F8F9FB;
  --soa-surface: #FFFFFF;
  --soa-border: #E8ECF1;
  --soa-text: #1A1D21;
  --soa-text-muted: #6B7280;
  --soa-primary: #1877F2;
  --soa-primary-hover: #1565D8;
  --soa-primary-soft: #EBF3FF;
  --soa-success: #16A34A;
  --soa-success-soft: #ECFDF3;
  --soa-warning: #F59E0B;
  --soa-warning-soft: #FFFBEB;
  --soa-danger: #DC2626;
  --soa-danger-soft: #FEF2F2;
  --soa-radius-sm: 8px;
  --soa-radius-md: 12px;
  --soa-radius-lg: 16px;
  --soa-shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06);
  --soa-shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --soa-sidebar-width: 260px;
  --soa-header-height: 64px;

  /* Bootstrap overrides */
  --bs-primary: #1877F2;
  --bs-primary-rgb: 24, 119, 242;
  --bs-body-bg: #F8F9FB;
  --bs-body-color: #1A1D21;
  --bs-border-color: #E8ECF1;
  --bs-link-color: #1877F2;
  --bs-link-hover-color: #1565D8;
  --bs-font-sans-serif: 'DM Sans', system-ui, -apple-system, sans-serif;
}

/* ---- Base ---- */
body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif !important;
  background: var(--soa-bg) !important;
  color: var(--soa-text);
}

h1, h2, h3, h4, h5, h6,
.pagetitle h1 {
  font-family: 'DM Sans', system-ui, sans-serif !important;
  color: var(--soa-text);
  font-weight: 600;
}

a {
  color: var(--soa-primary);
}

a:hover {
  color: var(--soa-primary-hover);
}

#main {
  margin-top: var(--soa-header-height);
  padding: 24px 28px;
}

.pagetitle {
  margin-bottom: 20px;
}

.pagetitle h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.breadcrumb {
  font-size: 0.8125rem;
}

.breadcrumb a {
  color: var(--soa-text-muted);
}

/* ---- Header ---- */
.header {
  background: var(--soa-surface) !important;
  box-shadow: var(--soa-shadow-sm) !important;
  border-bottom: 1px solid var(--soa-border);
  height: var(--soa-header-height);
  min-height: var(--soa-header-height);
}

.header .logo {
  gap: 10px;
}

.soa-logo {
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  color: var(--soa-primary) !important;
  letter-spacing: -0.02em;
}

/* Firm name in header (replaces generic SOA branding for tenant users) */
.soa-firm-logo {
  font-size: 0.8125rem !important;
  font-weight: 700 !important;
  color: var(--soa-primary) !important;
  letter-spacing: -0.01em;
  line-height: 1.2;
  max-width: 220px;
  display: block;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.soa-firm-logo-super {
  font-size: 0.875rem !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.soa-portal-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--soa-primary);
  background: var(--soa-primary-soft);
  border: 1px solid rgba(24, 119, 242, 0.15);
  border-radius: 999px;
  padding: 3px 10px;
  line-height: 1.2;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.soa-portal-badge-super {
  color: #fff;
  background: var(--soa-text);
  border-color: var(--soa-text);
}

.header-nav ul {
  gap: 4px;
}

.header-nav .nav-item {
  padding-right: 0 !important;
}

.header-nav .nav-link {
  color: var(--soa-text) !important;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 8px 12px !important;
  border-radius: var(--soa-radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s ease, color 0.12s ease;
}

.header-nav .nav-link i {
  font-size: 1rem;
  line-height: 1;
}

.header-nav .nav-link:hover {
  color: var(--soa-primary) !important;
  background: var(--soa-primary-soft);
}

.header-nav .nav-link.active {
  color: var(--soa-primary) !important;
  background: var(--soa-primary-soft);
}

.header-nav .nav-profile.dropdown-toggle::after,
.header-nav .nav-profile .dropdown-toggle::after {
  margin-left: 4px;
}

.nav-link-icon {
  color: var(--soa-text-muted) !important;
  padding: 8px 10px;
  border-radius: var(--soa-radius-sm);
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-link-icon:hover {
  color: var(--soa-primary) !important;
  background: var(--soa-primary-soft) !important;
}

.communication-icons {
  min-width: 280px;
  gap: 2px;
}

@media (max-width: 768px) {
  .communication-icons {
    min-width: auto;
    padding: 0 0.5rem;
  }
}

/* ---- Sidebar ---- */
.sidebar {
  background: var(--soa-surface) !important;
  border-right: 1px solid var(--soa-border);
  top: var(--soa-header-height);
  width: var(--soa-sidebar-width);
  padding: 16px 12px;
}

.sidebar-nav .nav-heading {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--soa-text-muted);
  margin: 16px 0 8px 12px;
  padding: 0;
}

.sidebar-nav .nav-heading:first-child {
  margin-top: 4px;
}

/* Inactive = collapsed (NiceAdmin convention) */
.sidebar-nav .nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--soa-text) !important;
  background: transparent !important;
  padding: 9px 12px;
  border-radius: var(--soa-radius-sm);
  margin-bottom: 2px;
}

.sidebar-nav .nav-link i {
  color: var(--soa-text-muted) !important;
  font-size: 1.05rem;
}

.sidebar-nav .nav-link.collapsed {
  color: var(--soa-text) !important;
  background: transparent !important;
}

.sidebar-nav .nav-link.collapsed i {
  color: var(--soa-text-muted) !important;
}

.sidebar-nav .nav-link:hover {
  color: var(--soa-primary) !important;
  background: var(--soa-primary-soft) !important;
}

.sidebar-nav .nav-link:hover i {
  color: var(--soa-primary) !important;
}

/* Active pill (UI-3) */
.sidebar-nav .nav-link.active {
  color: #fff !important;
  background: var(--soa-primary) !important;
  box-shadow: var(--soa-shadow-sm);
}

.sidebar-nav .nav-link.active i {
  color: #fff !important;
}

.sidebar-nav .nav-content a {
  color: var(--soa-text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 8px 12px 8px 36px;
  border-radius: var(--soa-radius-sm);
}

.sidebar-nav .nav-content a:hover,
.sidebar-nav .nav-content a.active {
  color: var(--soa-primary) !important;
  background: var(--soa-primary-soft);
}

.sidebar-nav .nav-content a.active {
  font-weight: 600;
}

/* ---- Cards ---- */
.card {
  border: 1px solid var(--soa-border) !important;
  border-radius: var(--soa-radius-md) !important;
  box-shadow: var(--soa-shadow-sm) !important;
  background: var(--soa-surface);
  margin-bottom: 24px;
}

.card-header {
  background: var(--soa-surface) !important;
  color: var(--soa-text) !important;
  border-bottom: 1px solid var(--soa-border) !important;
  border-radius: var(--soa-radius-md) var(--soa-radius-md) 0 0 !important;
  padding: 16px 20px;
  font-weight: 600;
}

.card-header.bg-primary,
.card-header.bg-success,
.card-header.bg-info,
.card-header.bg-danger,
.card-header.bg-warning,
.card-header.bg-secondary,
.card-header.bg-dark,
.card-header.text-white {
  background: var(--soa-surface) !important;
  color: var(--soa-text) !important;
  border-bottom: 1px solid var(--soa-border) !important;
}

.card-header.bg-primary.text-white h5,
.card-header.bg-primary.text-white h4,
.card-header.bg-info.text-white h5,
.card-header.bg-danger.text-white h5,
.card-header.bg-warning.text-white h5 {
  color: var(--soa-text) !important;
}

.card-header.bg-warning.bg-opacity-25,
.card-header.bg-warning.bg-opacity-10 {
  background: var(--soa-warning-soft) !important;
  color: var(--soa-text) !important;
}

.card-body {
  padding: 20px;
}

.card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--soa-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0;
  margin-bottom: 12px;
}

/* Metric / info cards */
.soa-metric-card,
.dashboard .info-card {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  cursor: default;
}

a:hover .soa-metric-card,
a:hover .dashboard .info-card {
  box-shadow: var(--soa-shadow-md) !important;
  transform: translateY(-2px);
}

.soa-metric-card .card-icon,
.dashboard .info-card .card-icon {
  width: 48px;
  height: 48px;
  font-size: 1.25rem;
}

.soa-metric-card .card-icon.icon-primary,
.dashboard .info-card .card-icon.icon-primary {
  background: var(--soa-primary-soft) !important;
  color: var(--soa-primary) !important;
}

.soa-metric-card .card-icon.icon-success,
.dashboard .info-card .card-icon.icon-success {
  background: var(--soa-success-soft) !important;
  color: var(--soa-success) !important;
}

.soa-metric-card .card-icon.icon-warning,
.dashboard .info-card .card-icon.icon-warning {
  background: var(--soa-warning-soft) !important;
  color: var(--soa-warning) !important;
}

.soa-metric-card .card-icon.icon-neutral,
.dashboard .info-card .card-icon.icon-neutral {
  background: #F3F4F6 !important;
  color: var(--soa-text-muted) !important;
}

.dashboard .info-card .card-icon,
.client-portal .info-card .card-icon {
  width: 48px !important;
  height: 48px !important;
  font-size: 1.25rem !important;
  background: var(--soa-primary-soft) !important;
  color: var(--soa-primary) !important;
}

.dashboard .info-card:nth-child(4n+2) .card-icon,
.client-portal .info-card:nth-child(4n+2) .card-icon {
  background: var(--soa-success-soft) !important;
  color: var(--soa-success) !important;
}

.dashboard .info-card:nth-child(4n+3) .card-icon {
  background: var(--soa-warning-soft) !important;
  color: var(--soa-warning) !important;
}

.dashboard .info-card:nth-child(4n) .card-icon {
  background: #F3F4F6 !important;
  color: var(--soa-text-muted) !important;
}

.soa-metric-card h6,
.dashboard .info-card h6,
.client-portal-dashboard .info-card h6 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--soa-text);
  margin: 0;
}

/* Full-width pill tab bars on detail pages */
.card .nav-pills,
#clientTabs,
#matterTabs,
#caseTabs,
#proposalTabs,
#entityTabs {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  background: #F3F4F6;
  padding: 4px;
  border-radius: var(--soa-radius-sm);
  gap: 4px;
}

/* ---- Buttons ---- */
.btn {
  font-weight: 500;
  border-radius: var(--soa-radius-sm);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

.btn-primary {
  background: var(--soa-primary) !important;
  border-color: var(--soa-primary) !important;
  color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--soa-primary-hover) !important;
  border-color: var(--soa-primary-hover) !important;
}

.btn-outline-primary {
  color: var(--soa-primary) !important;
  border-color: var(--soa-primary) !important;
}

.btn-outline-primary:hover {
  background: var(--soa-primary) !important;
  color: #fff !important;
}

.btn-success {
  background: var(--soa-success) !important;
  border-color: var(--soa-success) !important;
}

/* ---- Nav pills (tabs) ---- */
.nav-pills {
  gap: 6px;
  background: #F3F4F6;
  padding: 4px;
  border-radius: var(--soa-radius-sm);
  display: inline-flex;
  flex-wrap: wrap;
}

.nav-pills .nav-link {
  color: var(--soa-text-muted);
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: 6px;
  padding: 8px 16px;
}

.nav-pills .nav-link:hover {
  color: var(--soa-text);
  background: rgba(255, 255, 255, 0.7);
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  background: var(--soa-primary) !important;
  color: #fff !important;
}

/* Bootstrap nav-tabs → pill-like underline alternative kept for legacy; prefer nav-pills */
.nav-tabs {
  border-bottom: 1px solid var(--soa-border);
  gap: 4px;
}

.nav-tabs .nav-link {
  color: var(--soa-text-muted);
  font-weight: 500;
  border: none;
  border-radius: var(--soa-radius-sm) var(--soa-radius-sm) 0 0;
  padding: 10px 16px;
}

.nav-tabs .nav-link:hover {
  color: var(--soa-primary);
  border-color: transparent;
}

.nav-tabs .nav-link.active {
  color: var(--soa-primary) !important;
  background: var(--soa-primary-soft);
  border: none;
  font-weight: 600;
}

/* ---- Alerts ---- */
.alert {
  border-radius: var(--soa-radius-md);
  border: 1px solid var(--soa-border);
  font-size: 0.875rem;
}

.alert-primary {
  background: var(--soa-primary-soft);
  border-color: rgba(24, 119, 242, 0.2);
  color: var(--soa-text);
}

.alert-success {
  background: var(--soa-success-soft);
  border-color: rgba(22, 163, 74, 0.2);
  color: var(--soa-text);
}

.alert-warning {
  background: var(--soa-warning-soft);
  border-color: rgba(245, 158, 11, 0.25);
  color: var(--soa-text);
}

.alert-info {
  background: var(--soa-primary-soft);
  border-color: rgba(24, 119, 242, 0.15);
  color: var(--soa-text);
}

/* ---- Tables ---- */
.table {
  font-size: 0.875rem;
  color: var(--soa-text);
  margin-bottom: 0;
  --bs-table-hover-bg: var(--soa-primary-soft);
  --bs-table-hover-color: var(--soa-text);
  --bs-table-striped-bg: #FAFBFC;
  --bs-table-striped-color: var(--soa-text);
}

.table > :not(caption) > * > * {
  padding: 14px 16px;
  vertical-align: middle;
  border-bottom-color: var(--soa-border);
}

.table thead th {
  font-weight: 600;
  color: var(--soa-text-muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--soa-border);
  background: #FAFBFC;
  padding: 12px 16px;
  white-space: nowrap;
}

.table tbody tr {
  transition: background-color 0.12s ease;
}

.table tbody tr:last-child > * {
  border-bottom: 0;
}

.table-hover tbody tr:hover {
  background: var(--soa-primary-soft) !important;
}

.table-bordered {
  border-color: var(--soa-border);
}

.table-bordered > :not(caption) > * > * {
  border-color: var(--soa-border);
}

/* Card body wrapping a table: drop card padding so the table edges align with
   the header / footer, and keep the rounded card corners. */
.card-body > .table-responsive:only-child {
  margin: -20px;
  width: calc(100% + 40px);
}
.card-body > .table-responsive:only-child > .table {
  border-collapse: separate;
}
.card-body > .table-responsive:only-child > .table thead th:first-child,
.card-body > .table-responsive:only-child > .table tbody td:first-child {
  padding-left: 20px;
}
.card-body > .table-responsive:only-child > .table thead th:last-child,
.card-body > .table-responsive:only-child > .table tbody td:last-child {
  padding-right: 20px;
}

/* Action button group inside tables — tighter and visually grouped */
.table .btn-group .btn-sm,
.table td .btn-sm {
  padding: 0.3rem 0.55rem;
  font-size: 0.8125rem;
  line-height: 1;
}

.table .btn-group > .btn + .btn {
  margin-left: -1px;
}

.table .badge {
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0.4em 0.65em;
}

/* Avatar bubble next to a name cell */
.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.8125rem;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Forms ---- */
.form-control,
.form-select {
  border-radius: var(--soa-radius-sm);
  border-color: var(--soa-border);
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--soa-primary);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.15);
}

.form-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--soa-text);
  margin-bottom: 6px;
}

/* ---- Badges ---- */
.badge.bg-primary {
  background: var(--soa-primary) !important;
}

.badge.bg-success {
  background: var(--soa-success) !important;
}

.badge.bg-warning {
  background: var(--soa-warning) !important;
  color: #1A1D21 !important;
}

/* ---- Footer ---- */
.footer {
  background: var(--soa-surface);
  border-top: 1px solid var(--soa-border);
  color: var(--soa-text-muted);
  font-size: 0.8125rem;
  padding: 16px 0;
}

/* ---- Welcome banner (client portal) ---- */
.welcome-banner {
  background: var(--soa-surface);
  border: 1px solid var(--soa-border);
  border-radius: var(--soa-radius-md);
  padding: 24px 28px;
  box-shadow: var(--soa-shadow-sm);
}

.welcome-banner h2 {
  font-size: 1.25rem;
  color: var(--soa-text);
}

/* ---- Auth pages ---- */
.soa-auth-page {
  min-height: 100vh;
  background: var(--soa-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.soa-auth-card {
  background: var(--soa-surface);
  border: 1px solid var(--soa-border);
  border-radius: var(--soa-radius-lg);
  box-shadow: var(--soa-shadow-md);
  max-width: 440px;
  width: 100%;
  overflow: hidden;
}

.soa-auth-card-wide {
  max-width: 920px;
}

.soa-auth-brand {
  padding: 32px 28px;
  text-align: center;
  border-bottom: 1px solid var(--soa-border);
}

.soa-auth-brand .soa-logo {
  font-size: 1.75rem !important;
}

.soa-auth-body {
  padding: 28px 32px 32px;
}

.soa-auth-body .form-control {
  padding: 0.625rem 0.875rem;
}

.soa-auth-submit {
  width: 100%;
  padding: 0.75rem;
  font-weight: 600;
}

/* ---- Page header component ---- */
.soa-page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.soa-page-header h1 {
  font-size: 1.5rem;
  margin: 0 0 4px;
}

.soa-page-header .soa-page-subtitle {
  color: var(--soa-text-muted);
  font-size: 0.9375rem;
  margin: 0;
}

/* ---- Remove legacy gradient stats ---- */
.stats-card {
  background: var(--soa-surface) !important;
  color: var(--soa-text) !important;
  border: 1px solid var(--soa-border);
  box-shadow: var(--soa-shadow-sm);
}

.stats-card h3 {
  color: var(--soa-text) !important;
}

/* ---- Section spacing ---- */
.section {
  padding: 0;
}

@media (max-width: 1199px) {
  #main {
    padding: 20px 16px;
  }
}

@media (min-width: 1200px) {
  #footer {
    margin-left: var(--soa-sidebar-width);
  }
}

/* ============================================================
   Phase 2–4: modules, utilities, standalone pages
   ============================================================ */

/* ---- Help / manual pages ---- */
.um-section,
.portal-um-section {
  scroll-margin-top: 96px;
}

.um-h2,
.portal-um-h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--soa-text);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--soa-border);
  margin-bottom: 1rem;
}

.um-lead { font-size: 1.05rem; color: var(--soa-text-muted); }
.um-bullets li,
.um-steps li,
.portal-um-list li,
.portal-um-steps li {
  margin-bottom: 0.5rem;
  line-height: 1.65;
}
.um-steps,
.portal-um-steps { padding-left: 1.25rem; }
.um-table th { font-weight: 600; color: var(--soa-text); }
.um-toc-link,
.portal-um-toc {
  text-decoration: none;
  color: var(--soa-text);
  border-radius: var(--soa-radius-sm);
}
.um-toc-link:hover,
.portal-um-toc:hover {
  background: var(--soa-primary-soft);
  color: var(--soa-primary);
}

.um-toc-card .card-header,
.portal-um-toc-card .card-header {
  background: var(--soa-surface) !important;
}

/* ---- Active client instruction groups ---- */
.ac-instruction-card {
  border-left: 3px solid var(--soa-primary);
}
.ac-instruction-card > .card-header {
  background: var(--soa-primary-soft) !important;
  border-bottom: 1px solid rgba(24, 119, 242, 0.15);
  color: var(--soa-text);
}
.ac-instruction-card > .card-header .text-secondary {
  color: var(--soa-text-muted) !important;
}
.ac-unassigned-card {
  border-left: 3px solid var(--soa-text-muted);
}
.ac-unassigned-card > .card-header {
  background: #F3F4F6 !important;
  color: var(--soa-text);
}

.card-header.bg-light {
  background: #FAFBFC !important;
  color: var(--soa-text) !important;
  border-bottom: 1px solid var(--soa-border);
}

.card-header.bg-info-subtle,
.card-header.bg-success-subtle {
  background: var(--soa-primary-soft) !important;
  color: var(--soa-text) !important;
  border-bottom: 1px solid var(--soa-border);
}

/* ---- Kanban / boards ---- */
.soa-board-canvas,
.client-board {
  background: var(--soa-bg);
  min-height: calc(100vh - 200px);
  padding: 20px;
  border-radius: var(--soa-radius-md);
}

.board-lists { min-height: 200px; }
.board-list .card-header { background: #FAFBFC !important; }

.lists-container {
  overflow-x: auto;
  padding-bottom: 8px;
}

.sortable-ghost { opacity: 0.4; }
.sortable-chosen { cursor: move; }
.sortable-drag { transform: rotate(2deg); }

.card-item {
  border: 1px solid var(--soa-border) !important;
  transition: box-shadow 0.2s ease;
}
.card-item:hover {
  box-shadow: var(--soa-shadow-md) !important;
}

.lists-container::-webkit-scrollbar { height: 8px; }
.lists-container::-webkit-scrollbar-track {
  background: #F3F4F6;
  border-radius: 4px;
}
.lists-container::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 4px;
}
.lists-container::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ---- Chat & comms ---- */
.conversation-item.unread {
  background: var(--soa-primary-soft);
  font-weight: 500;
}
.conversation-item:hover {
  background: #FAFBFC;
}

.soa-comms-layout {
  display: flex;
  gap: 16px;
  min-height: 480px;
}
.soa-comms-sidebar {
  flex: 0 0 320px;
  max-width: 100%;
  border: 1px solid var(--soa-border);
  border-radius: var(--soa-radius-md);
  background: var(--soa-surface);
  overflow: hidden;
}
.soa-comms-main {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--soa-border);
  border-radius: var(--soa-radius-md);
  background: var(--soa-surface);
}

/* ---- Standalone payment pages ---- */
.soa-payment-card {
  background: var(--soa-surface);
  border: 1px solid var(--soa-border);
  border-radius: var(--soa-radius-lg);
  box-shadow: var(--soa-shadow-md);
  max-width: 560px;
  width: 100%;
  overflow: hidden;
}

.soa-payment-header {
  padding: 28px 24px;
  text-align: center;
  border-bottom: 1px solid var(--soa-border);
  background: var(--soa-primary-soft);
}

.soa-payment-header--success {
  background: var(--soa-success-soft);
}

.soa-payment-header h2 {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.soa-payment-body { padding: 28px 32px 32px; }

.soa-amount-display {
  font-size: 2rem;
  font-weight: 700;
  color: var(--soa-primary);
  text-align: center;
  margin: 1rem 0;
}

.soa-amount-display--success { color: var(--soa-success); }

.soa-payment-method {
  border: 1px solid var(--soa-border);
  border-radius: var(--soa-radius-sm);
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.soa-payment-method:hover {
  border-color: var(--soa-primary);
  background: var(--soa-primary-soft);
}
.soa-payment-method.selected {
  border-color: var(--soa-primary);
  background: var(--soa-primary-soft);
}

.soa-transaction-details {
  background: #FAFBFC;
  border: 1px solid var(--soa-border);
  border-radius: var(--soa-radius-sm);
  padding: 1.25rem;
  margin: 1rem 0;
}

.stripe-element {
  padding: 12px 15px;
  border: 1px solid var(--soa-border);
  border-radius: var(--soa-radius-sm);
  background: var(--soa-surface);
}

/* ---- Empty state ---- */
.soa-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--soa-text-muted);
}
.soa-empty-state i {
  font-size: 2.5rem;
  color: var(--soa-text-muted);
  opacity: 0.5;
  margin-bottom: 12px;
}
.soa-empty-state h3 {
  font-size: 1.125rem;
  color: var(--soa-text);
  margin-bottom: 8px;
}

/* ---- PDF viewer modal clip ---- */
#docViewerBody.pdf-clip {
  overflow: hidden !important;
  position: relative !important;
}
#docViewerBody.pdf-clip > iframe {
  position: absolute !important;
  top: -72px !important;
  left: 0 !important;
  width: 100% !important;
  height: calc(100% + 72px) !important;
  border: 0 !important;
  display: block !important;
}

/* ---- Onboarding / list stat icons ---- */
.section .info-card .card-icon {
  width: 48px !important;
  height: 48px !important;
  font-size: 1.25rem !important;
}

.icon-primary {
  background: var(--soa-primary-soft) !important;
  color: var(--soa-primary) !important;
}
.icon-success {
  background: var(--soa-success-soft) !important;
  color: var(--soa-success) !important;
}
.icon-warning {
  background: var(--soa-warning-soft) !important;
  color: var(--soa-warning) !important;
}
.icon-neutral {
  background: #F3F4F6 !important;
  color: var(--soa-text-muted) !important;
}
.icon-info {
  background: #EEF2FF !important;
  color: #6366F1 !important;
}
.icon-danger {
  background: var(--soa-danger-soft) !important;
  color: var(--soa-danger) !important;
}

/* ---- Portal / list cards ---- */
.soa-list-card {
  border-left: 4px solid var(--soa-primary);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.soa-list-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--soa-shadow-md);
}

.board-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.board-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--soa-shadow-md);
}

/* ---- Mail inbox ---- */
.soa-mail-layout {
  height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
}
.soa-mail-layout .soa-mail-body {
  height: calc(100% - 50px);
}
.soa-mail-sidebar .list-group-item {
  border: none;
  cursor: pointer;
}
.soa-mail-sidebar .list-group-item.active {
  background: var(--soa-primary-soft);
  color: var(--soa-primary);
}
.mail-unread {
  background-color: var(--soa-bg);
}

/* ---- Table dropdown overflow fix ---- */
.soa-table-dropdown .table-responsive {
  overflow-x: auto;
  overflow-y: visible !important;
}
.soa-table-dropdown .table td {
  position: relative;
}
.soa-table-dropdown .dropdown-menu {
  position: absolute !important;
  z-index: 9999 !important;
}
.soa-table-dropdown .table-responsive .dropdown-menu,
.soa-table-dropdown .dropdown.show .dropdown-menu {
  position: fixed !important;
}

/* ---- Legal AI stat tiles ---- */
.soa-stat-tile {
  border-radius: var(--soa-radius-sm);
  padding: 1rem;
}
.soa-stat-tile-primary { background: var(--soa-primary); color: #fff; }
.soa-stat-tile-success { background: var(--soa-success); color: #fff; }
.soa-stat-tile-info { background: #6366F1; color: #fff; }

.soa-card-header-brand {
  background: var(--soa-primary) !important;
  color: #fff !important;
  border-radius: var(--soa-radius-md) var(--soa-radius-md) 0 0 !important;
}
.soa-card-header-brand .card-title {
  color: #fff !important;
}

.manual-section a {
  color: var(--soa-primary);
}
.manual-section a:hover {
  color: var(--soa-primary-hover);
  text-decoration: underline;
}

.soa-error-card {
  background: var(--soa-surface);
  border-radius: var(--soa-radius-lg);
  padding: 3rem;
  max-width: 500px;
  text-align: center;
  box-shadow: var(--soa-shadow-md);
}
.soa-error-icon {
  font-size: 4rem;
  color: var(--soa-danger);
  margin-bottom: 1.5rem;
}

/* ---- Chat message bubbles ---- */
.soa-messages-container {
  height: 500px;
  overflow-y: auto;
  padding: 1rem;
}
.soa-msg-bubble {
  max-width: 70%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
}
.soa-msg-bubble.sent {
  background-color: var(--soa-primary);
  color: #fff;
}
.soa-msg-bubble.received {
  background-color: #f1f3f5;
}
.soa-msg-bubble a {
  text-decoration: underline;
  font-weight: 500;
}
.soa-msg-bubble.sent a {
  color: rgba(255, 255, 255, 0.95);
}
.soa-msg-bubble.received a {
  color: var(--soa-primary);
}

/* ---- Top bar notifications dropdown ---- */
.dropdown-menu {
  border: 1px solid var(--soa-border);
  border-radius: var(--soa-radius-md);
  box-shadow: var(--soa-shadow-md);
  padding: 6px;
}

.dropdown-menu .dropdown-item {
  border-radius: var(--soa-radius-sm);
  padding: 8px 10px;
  font-size: 0.875rem;
  color: var(--soa-text);
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
  background: var(--soa-primary-soft);
  color: var(--soa-text);
}

.dropdown-menu .dropdown-divider {
  border-top-color: var(--soa-border);
  margin: 6px 4px;
}

.dropdown-menu.notifications,
.dropdown-menu.profile {
  min-width: 320px;
  padding: 6px;
}

.dropdown-menu.notifications {
  max-height: 420px;
  overflow-y: auto;
}

.dropdown-menu.notifications .dropdown-item {
  align-items: flex-start;
  padding: 10px 10px;
  white-space: normal;
  line-height: 1.35;
}

.dropdown-menu.notifications .dropdown-item > i:first-child {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--soa-primary-soft);
  color: var(--soa-primary) !important;
  font-size: 0.95rem;
  margin-top: 2px;
}

.dropdown-menu.notifications .dropdown-item .small {
  font-size: 0.75rem;
}

.dropdown-menu.notifications .dropdown-item .fw-semibold {
  font-size: 0.875rem;
  color: var(--soa-text);
}

.dropdown-menu.notifications .dropdown-header {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--soa-text);
  padding: 8px 10px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dropdown-menu.notifications > li:last-child .dropdown-item {
  font-weight: 600;
  color: var(--soa-primary) !important;
  text-align: center;
  background: var(--soa-bg);
}

.dropdown-menu.notifications > li:last-child .dropdown-item:hover {
  background: var(--soa-primary-soft);
}

.dropdown-menu.profile .dropdown-header {
  padding: 10px 10px 6px;
}

.dropdown-menu.profile .dropdown-header h6 {
  font-size: 0.9375rem;
  margin: 0;
  font-weight: 600;
  color: var(--soa-text);
}

.dropdown-menu.profile .dropdown-header span {
  font-size: 0.75rem;
  color: var(--soa-text-muted);
}

/* Header bell badge — smaller, balanced */
.header-nav .nav-link .badge.rounded-pill {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.2em 0.45em;
  min-width: 16px;
  line-height: 1;
}

/* ---- Guest portal header ---- */
.guest-header {
  background: var(--soa-surface);
  border-bottom: 1px solid var(--soa-border);
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  box-shadow: var(--soa-shadow-sm);
}
.guest-badge {
  background: var(--soa-primary-soft);
  color: var(--soa-primary);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}

/* ---- Accessibility ---- */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid var(--soa-primary);
  outline-offset: 2px;
}

.soa-standalone-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ----------------------------------------------------------------------
 * simple-datatables — modern layout
 *
 * The bundled JS emits the new class names
 * (datatable-pagination-list, *-list-item, *-list-item-link) but the
 * legacy stylesheet only floats `.datatable-pagination li / a / button`
 * which doesn't reliably layout in modern browsers — the items stack
 * vertically. These rules override with flexbox and style the buttons to
 * match the rest of the SOA theme.
 * -------------------------------------------------------------------- */
.datatable-wrapper {
  font-size: 0.875rem;
}

.datatable-top,
.datatable-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px;
}

.datatable-top > *,
.datatable-bottom > * {
  float: none !important;
}

.datatable-info {
  margin: 0;
  color: var(--soa-text-muted);
  font-size: 0.8125rem;
}

.datatable-dropdown,
.datatable-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.datatable-selector,
.datatable-input {
  border: 1px solid var(--soa-border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.8125rem;
  background: var(--soa-surface);
  color: var(--soa-text);
}

.datatable-selector:focus,
.datatable-input:focus {
  outline: none;
  border-color: var(--soa-primary);
  box-shadow: 0 0 0 3px var(--soa-primary-soft);
}

/* Pagination — modern markup */
.datatable-pagination {
  margin: 0;
}

.datatable-pagination ul,
.datatable-pagination .datatable-pagination-list {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.datatable-pagination li,
.datatable-pagination .datatable-pagination-list-item {
  float: none !important;
  list-style: none;
  margin: 0;
}

.datatable-pagination a,
.datatable-pagination button,
.datatable-pagination .datatable-pagination-list-item-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  margin: 0;
  border: 1px solid var(--soa-border);
  border-radius: 8px;
  background: var(--soa-surface);
  color: var(--soa-text);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.datatable-pagination a:hover,
.datatable-pagination button:hover,
.datatable-pagination .datatable-pagination-list-item-link:hover {
  background: var(--soa-primary-soft);
  border-color: var(--soa-primary-soft);
  color: var(--soa-primary);
}

.datatable-pagination .datatable-active a,
.datatable-pagination .datatable-active button,
.datatable-pagination .datatable-active .datatable-pagination-list-item-link {
  background: var(--soa-primary);
  border-color: var(--soa-primary);
  color: #fff;
  cursor: default;
}

.datatable-pagination .datatable-active a:hover,
.datatable-pagination .datatable-active button:hover,
.datatable-pagination .datatable-active .datatable-pagination-list-item-link:hover {
  background: var(--soa-primary-hover);
  border-color: var(--soa-primary-hover);
  color: #fff;
}

.datatable-pagination .datatable-disabled a,
.datatable-pagination .datatable-disabled button,
.datatable-pagination .datatable-disabled .datatable-pagination-list-item-link {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--soa-surface);
  color: var(--soa-text-muted);
}

.datatable-pagination .datatable-ellipsis a,
.datatable-pagination .datatable-ellipsis button {
  border: none;
  background: transparent;
  cursor: default;
}

.datatable-pagination .datatable-hidden {
  display: none !important;
}

/* On small screens stack the top/bottom rows */
@media (max-width: 575.98px) {
  .datatable-top,
  .datatable-bottom {
    justify-content: flex-start;
  }
}
