/* ============================================================
   Assurify Insurer Portal — app.css
   Custom stylesheet on top of Bootstrap 5
   Primary: Indigo #4f46e5 | Dark mode via [data-theme="dark"]
   ============================================================ */

/* ─── 1. CSS CUSTOM PROPERTIES ─────────────────────────────── */
:root {
  --primary:        #4f46e5;
  --primary-hover:  #4338ca;
  --primary-light:  #eef2ff;
  --primary-dark:   #3730a3;

  /* Backgrounds */
  --bg:             #f8fafc;
  --sidebar-bg:     #1e1b4b;
  --header-bg:      rgba(255, 255, 255, 0.85);
  --card-bg:        #ffffff;
  --card-border:    #e2e8f0;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #334155;
  --text-muted:     #64748b;

  /* UI */
  --border-color:   #e2e8f0;
  --input-bg:       #ffffff;
  --table-hover:    #f1f5f9;

  /* Shadows */
  --shadow-sm:      0 1px 3px 0 rgba(0,0,0,.07), 0 1px 2px -1px rgba(0,0,0,.05);
  --shadow-md:      0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);

  /* KPI icon palettes */
  --kpi-indigo-bg:  #eef2ff;
  --kpi-indigo-fg:  #4f46e5;
  --kpi-emerald-bg: #d1fae5;
  --kpi-emerald-fg: #059669;
  --kpi-rose-bg:    #ffe4e6;
  --kpi-rose-fg:    #e11d48;
  --kpi-amber-bg:   #fef3c7;
  --kpi-amber-fg:   #d97706;
}

[data-theme="dark"] {
  --bg:             #0f172a;
  --sidebar-bg:     #0d0b24;
  --header-bg:      rgba(15, 23, 42, 0.85);
  --card-bg:        #1e293b;
  --card-border:    #334155;

  --text-primary:   #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted:     #94a3b8;

  --border-color:   #334155;
  --input-bg:       #1e293b;
  --table-hover:    #1e293b;

  --primary-light:  #1e1b4b;

  --kpi-indigo-bg:  #1e1b4b;
  --kpi-indigo-fg:  #818cf8;
  --kpi-emerald-bg: #064e3b;
  --kpi-emerald-fg: #34d399;
  --kpi-rose-bg:    #4c0519;
  --kpi-rose-fg:    #fb7185;
  --kpi-amber-bg:   #451a03;
  --kpi-amber-fg:   #fbbf24;
}

/* ─── 2. BASE RESETS ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;
  min-height: 100%;
  transition: background-color .2s, color .2s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ─── 3. BOOTSTRAP PRIMARY OVERRIDES ────────────────────────── */
.btn-primary {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
  box-shadow: 0 0 0 .25rem rgba(79,70,229,.35) !important;
}

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

.text-primary { color: var(--primary) !important; }
.bg-primary   { background-color: var(--primary) !important; }

/* ─── 4. APP LAYOUT ──────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.sidebar {
  width: 256px;
  min-height: 100vh;
  background-color: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.main-content {
  margin-left: 256px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── 5. SIDEBAR STYLES ──────────────────────────────────────── */
.sidebar-brand {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #818cf8, #4f46e5);
  border-radius: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: .9rem;
  font-weight: 700;
  color: #fff;
  margin-left: .75rem;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: .65rem;
  color: rgba(255,255,255,.5);
  font-weight: 400;
  display: block;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 1rem .75rem;
  flex: 1;
  gap: .125rem;
}

.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .75rem .75rem .35rem;
}

.nav-item-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: .75rem;
  color: rgba(241, 245, 249, 0.85);
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.nav-item-link i, .nav-item-link .nav-icon {
  color: rgba(241, 245, 249, 0.75);
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.nav-item-link:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  text-decoration: none;
  transform: translateX(4px);
}

.nav-item-link:hover i, .nav-item-link:hover .nav-icon {
  color: #ffffff;
  transform: scale(1.1);
}

.nav-item-link.active {
  background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4) !important;
}

.nav-item-link.active i, .nav-item-link.active .nav-icon {
  color: #ffffff !important;
}

.nav-item-link .nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: .65rem;
  padding: .15rem .45rem;
  border-radius: 99px;
  font-weight: 600;
}

.nav-item-link.active .nav-badge {
  background: rgba(255,255,255,.25);
}

.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

/* ─── 6. TOP HEADER ──────────────────────────────────────────── */
.top-header {
  height: 64px;
  background-color: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: .75rem;
  flex-shrink: 0;
}

.breadcrumb {
  margin: 0;
  padding: 0;
  background: none;
}

.breadcrumb-item { font-size: .8rem; color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-primary); font-weight: 600; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

.header-spacer { flex: 1; }

.header-btn {
  width: 36px;
  height: 36px;
  border-radius: .625rem;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
  position: relative;
  flex-shrink: 0;
}
.header-btn:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .375rem .75rem .375rem .375rem;
  border-radius: 99px;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  cursor: pointer;
  transition: border-color .18s;
}
.user-chip:hover { border-color: var(--primary); }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #818cf8, #4f46e5);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name-text {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role-text {
  font-size: .65rem;
  color: var(--text-muted);
  display: block;
}

/* ─── 7. PAGE CONTENT ────────────────────────────────────────── */
.page-body {
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
  animation: fadeInPage .3s ease;
}

.page-header {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}

.page-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.page-subtitle {
  font-size: .8rem;
  color: var(--text-muted);
  margin: .25rem 0 0;
}

/* ─── 8. CARDS ───────────────────────────────────────────────── */
.app-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .2s;
}
.app-card:hover { box-shadow: var(--shadow-md); }

.app-card .card-header-bar {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: var(--text-primary);
}

.app-card .card-body-pad {
  padding: 1.25rem;
}

/* KPI Cards */
.kpi-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: .875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  margin-bottom: .875rem;
  flex-shrink: 0;
}

.kpi-value {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-label {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: .125rem;
}

.kpi-change {
  font-size: .75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  margin-top: .5rem;
}

.kpi-change.up   { color: #059669; }
.kpi-change.down { color: #e11d48; }

.kpi-desc {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

/* KPI icon variants */
.kpi-indigo  { background-color: var(--kpi-indigo-bg);  color: var(--kpi-indigo-fg); }
.kpi-emerald { background-color: var(--kpi-emerald-bg); color: var(--kpi-emerald-fg); }
.kpi-rose    { background-color: var(--kpi-rose-bg);    color: var(--kpi-rose-fg); }
.kpi-amber   { background-color: var(--kpi-amber-bg);   color: var(--kpi-amber-fg); }

/* ─── 9. BADGES ──────────────────────────────────────────────── */
.badge-success,
.badge-warning,
.badge-danger,
.badge-primary,
.badge-info,
.badge-secondary,
.badge-role {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 99px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1;
}

.badge-success   { background: #d1fae5; color: #065f46; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-danger    { background: #ffe4e6; color: #9f1239; }
.badge-primary   { background: var(--primary-light); color: var(--primary); }
.badge-info      { background: #e0f2fe; color: #0369a1; }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-role      { background: #ede9fe; color: #5b21b6; }

[data-theme="dark"] .badge-success   { background: #064e3b; color: #34d399; }
[data-theme="dark"] .badge-warning   { background: #451a03; color: #fbbf24; }
[data-theme="dark"] .badge-danger    { background: #4c0519; color: #fb7185; }
[data-theme="dark"] .badge-primary   { background: #1e1b4b; color: #818cf8; }
[data-theme="dark"] .badge-info      { background: #0c4a6e; color: #38bdf8; }
[data-theme="dark"] .badge-secondary { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] .badge-role      { background: #2e1065; color: #c4b5fd; }

/* ─── 10. DATA TABLE ─────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  background-color: var(--card-bg);
}

.data-table tbody td {
  font-size: .8rem;
  color: var(--text-secondary);
  padding: .8125rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td {
  background-color: var(--table-hover);
}

.table-row-clickable {
  cursor: pointer;
  transition: background .15s;
}

.sortable {
  cursor: pointer;
  user-select: none;
}
.sortable:hover { color: var(--text-primary); }
.sortable::after { content: ' ↕'; font-size: .6rem; opacity: .5; }
.sortable.asc::after  { content: ' ↑'; opacity: 1; }
.sortable.desc::after { content: ' ↓'; opacity: 1; }

/* ─── 11. TAB NAVIGATION ─────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: .25rem;
  padding: .375rem;
  background-color: var(--table-hover);
  border-radius: .875rem;
  border: 1px solid var(--border-color);
  width: fit-content;
}

.tab-btn {
  padding: .4rem 1rem;
  border-radius: .625rem;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,.5); }

.tab-btn.active {
  background-color: var(--card-bg);
  color: var(--primary);
  border-color: var(--border-color);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .tab-btn:hover { background: rgba(255,255,255,.06); }
[data-theme="dark"] .tab-btn.active { background: var(--card-bg); }

/* ─── 12. FORM ELEMENTS ──────────────────────────────────────── */
.form-label-sm {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .3rem;
}

.form-control,
.form-select {
  background-color: var(--input-bg) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
  border-radius: .75rem !important;
  font-size: .8375rem;
  transition: border-color .18s, box-shadow .18s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(79,70,229,.15) !important;
  background-color: var(--input-bg) !important;
  color: var(--text-primary) !important;
}

.form-control::placeholder { color: var(--text-muted); }

.search-wrapper {
  position: relative;
  display: inline-block;
}

.search-icon {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .875rem;
  pointer-events: none;
  z-index: 2;
}

.search-input {
  padding-left: 2.25rem !important;
  min-width: 220px;
}

/* ─── 13. BUTTONS ────────────────────────────────────────────── */
.btn { border-radius: .75rem !important; font-weight: 500; }

.btn-sm { font-size: .75rem !important; padding: .3rem .7rem !important; }

.btn-indigo {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-indigo:hover,
.btn-indigo:focus {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  box-shadow: 0 0 0 .25rem rgba(79,70,229,.3);
}

/* ─── 14. BOOTSTRAP MODAL DARK MODE ─────────────────────────── */
.modal-content {
  background-color: var(--card-bg);
  border-color: var(--card-border);
  color: var(--text-primary);
}

.modal-header {
  border-bottom-color: var(--border-color);
}

.modal-footer {
  border-top-color: var(--border-color);
}

.modal-title { color: var(--text-primary); font-weight: 700; }

.btn-close {
  filter: none;
}
[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%);
}

/* ─── 15. TOAST SYSTEM ───────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .625rem;
  align-items: flex-end;
}

.toast {
  background-color: var(--card-bg) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: .875rem !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-lg) !important;
  min-width: 280px;
  max-width: 360px;
}

.toast-header {
  background-color: transparent !important;
  border-bottom-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

.toast-body { font-size: .8125rem; }

/* ─── 16. MOBILE SIDEBAR ─────────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .page-body {
    padding: 1rem;
  }

  .user-info-text { display: none; }

  .top-header { padding: 0 1rem; }
}

/* ─── 17. NOTIFICATION DROPDOWN ──────────────────────────────── */
.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background-color: #e11d48;
  border-radius: 50%;
  border: 2px solid var(--card-bg);
}

.notif-badge.has-count {
  width: auto;
  height: auto;
  padding: .05rem .3rem;
  font-size: .55rem;
  font-weight: 700;
  color: #fff;
  border-radius: 99px;
  top: 2px;
  right: 2px;
}

.notif-dropdown {
  width: 320px;
  border-radius: 1rem !important;
  border-color: var(--border-color) !important;
  background-color: var(--card-bg) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
  overflow: hidden;
}

.notif-dropdown-header {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: .85rem;
  color: var(--text-primary);
}

.notif-item {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  transition: background .15s;
  cursor: pointer;
}
.notif-item:hover { background-color: var(--table-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background-color: var(--primary-light); }

.notif-icon {
  width: 32px;
  height: 32px;
  border-radius: .625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
  flex-shrink: 0;
}

.notif-text {
  font-size: .775rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.notif-time {
  font-size: .675rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* ─── 18. LOGIN PAGE ─────────────────────────────────────────── */
.login-page {
  display: flex;
  min-height: 100vh;
}

.login-brand-panel {
  flex: 1;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4f46e5 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}

.login-brand-panel::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(129,140,248,.3) 0%, transparent 70%);
  top: -100px;
  right: -100px;
}

.login-brand-panel::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,.25) 0%, transparent 70%);
  bottom: -80px;
  left: -80px;
}

.login-brand-logo {
  width: 72px;
  height: 72px;
  background: rgba(255,255,255,.15);
  border-radius: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(8px);
  z-index: 1;
}

.login-brand-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: .5rem;
  z-index: 1;
}

.login-brand-desc {
  color: rgba(255,255,255,.7);
  text-align: center;
  font-size: .875rem;
  max-width: 320px;
  z-index: 1;
}

.login-form-panel {
  width: 480px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background-color: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
}

@media (max-width: 768px) {
  .login-brand-panel { display: none; }
  .login-form-panel  { width: 100%; padding: 2rem 1.25rem; }
}

/* ─── 19. ANIMATIONS ─────────────────────────────────────────── */
@keyframes fadeInPage {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── 20. RISK SCORE BADGES ──────────────────────────────────── */
.risk-high { background: #ffe4e6; color: #9f1239; border-radius: 99px; padding: .2rem .55rem; font-size: .65rem; font-weight: 700; }
.risk-med  { background: #fef3c7; color: #92400e; border-radius: 99px; padding: .2rem .55rem; font-size: .65rem; font-weight: 700; }
.risk-low  { background: #d1fae5; color: #065f46; border-radius: 99px; padding: .2rem .55rem; font-size: .65rem; font-weight: 700; }

[data-theme="dark"] .risk-high { background: #4c0519; color: #fb7185; }
[data-theme="dark"] .risk-med  { background: #451a03; color: #fbbf24; }
[data-theme="dark"] .risk-low  { background: #064e3b; color: #34d399; }

/* ─── 21. TRANSACTION TYPES ──────────────────────────────────── */
.tx-premium    { color: #059669; font-weight: 600; }
.tx-payout     { color: #e11d48; font-weight: 600; }
.tx-commission { color: #d97706; font-weight: 600; }

[data-theme="dark"] .tx-premium    { color: #34d399; }
[data-theme="dark"] .tx-payout     { color: #fb7185; }
[data-theme="dark"] .tx-commission { color: #fbbf24; }

/* ─── 22. UPLOAD ZONE ────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: 1rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  background-color: var(--table-hover);
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.upload-zone:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}
.upload-zone-icon {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.upload-zone-text { color: var(--text-muted); font-size: .8375rem; }
.upload-zone-link { color: var(--primary); font-weight: 600; }

/* ─── 23. SETTINGS ───────────────────────────────────────────── */
.settings-menu-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .875rem;
  border-radius: .75rem;
  color: var(--text-secondary);
  font-size: .8125rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.settings-menu-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}
.settings-menu-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* Toggle switch */
.form-check-input:checked {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}
.form-check-input:focus {
  box-shadow: 0 0 0 .25rem rgba(79,70,229,.25) !important;
}

/* ─── 24. UTILITIES ──────────────────────────────────────────── */
.opacity-60 { opacity: .6; }

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
}
.empty-state-icon {
  font-size: 3rem;
  color: var(--text-muted);
  opacity: .4;
  margin-bottom: 1rem;
}
.empty-state-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: .375rem;
}
.empty-state-desc { color: var(--text-muted); font-size: .8125rem; }

.doc-card {
  border: 1px solid var(--border-color);
  border-radius: .875rem;
  padding: 1rem;
  background: var(--card-bg);
  cursor: pointer;
  transition: box-shadow .18s, border-color .18s;
}
.doc-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.apikey-row {
  font-family: 'Courier New', Courier, monospace;
  font-size: .8rem;
  background: var(--table-hover);
  padding: .5rem .875rem;
  border-radius: .625rem;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  word-break: break-all;
}

.alert-info-custom {
  background-color: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: .875rem;
  padding: .875rem 1rem;
  color: #92400e;
  font-size: .8rem;
}
[data-theme="dark"] .alert-info-custom {
  background-color: #451a03;
  border-color: #78350f;
  color: #fbbf24;
}

/* ─── 25. DROPDOWN DARK MODE ─────────────────────────────────── */
.dropdown-menu {
  background-color: var(--card-bg);
  border-color: var(--border-color);
  border-radius: .875rem;
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
}

.dropdown-item {
  color: var(--text-secondary);
  font-size: .8125rem;
  border-radius: .5rem;
  margin: .1rem .25rem;
  width: calc(100% - .5rem);
}
.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--primary-light);
  color: var(--primary);
}

.dropdown-divider { border-color: var(--border-color); }

/* ─── 26. SCROLLBAR CUSTOMIZATION ────────────────────────────── */
::-webkit-scrollbar               { width: 6px; height: 6px; }
::-webkit-scrollbar-track         { background: transparent; }
::-webkit-scrollbar-thumb         { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover   { background: var(--text-muted); }

/* ─── 27. RESPONSIVE UTILITIES ───────────────────────────────── */
@media (max-width: 575px) {
  .page-title { font-size: 1.125rem; }
  .kpi-value  { font-size: 1.375rem; }
  .hide-xs    { display: none !important; }
}

@media (max-width: 767px) {
  .hide-sm { display: none !important; }
}

/* ─── 28. PRINT ──────────────────────────────────────────────── */
@media print {
  .sidebar, .top-header, #toast-container { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-body    { padding: 0 !important; }
  .app-card, .kpi-card { box-shadow: none !important; border: 1px solid #ccc !important; }
}
