[data-bs-theme=light]:root {
  --bs-body-bg: #edede9;
  --bs-body-color: #333333;
  --header-bg: #2c5fc4;
  --header-button-color: #ffffdd;
  --header-button-bg-color: #2c5fc4;
  --header-button-border: 1px solid #ffffff;
  --my-blue: #2e8bcc;
  --selected-bg: #ebf9ff;
  --selected-color: #2e8bcc;
  --seen: grey;
  --highlighted-bg: #ffffdd;
  --highlighted-color: #2e8bcc;
  --highlighted-seen-bg: #ffffdd;
  --highlighted-seen-color: #333;
  --deleted-bg: #adb5bd;
  --text-deleted: #d90429;
  --tag: purple;
  --subject-color: #2e8bcc;
  --summary-font-weight: 500;
  --mssghglght-bg: lightblue;
  --mssghglght-color: #333;
  --darkmode-icon-color: #2c5fc4;
  --bs-border-color: #cbd5e0;
  --redacted-bg: #000;
  --redacted-color: #000;
  --drawer-text-color: #333333;
  --drawer-heading-color: #2c5fc4;
  --drawer-section-heading-color: #1a5490;
  --drawer-muted-color: #6c757d;
}

[data-bs-theme=dark]:root {
    --bs-body-bg: #232B32;
    --bs-body-color: #cccccc;
    --header-bg: #232B32;
    --header-button-color: #111;
    --header-button-bg-color: #bb86fc;
    --header-button-border: 1px solid #bbb;
    --my-blue: white;
    --selected-bg: #444;
    --selected-color: #bbb;
    --seen: #888;
    --highlighted-bg: #bb86fc;
    --highlighted-color: #111;
    --highlighted-seen-bg: #bb86fc;
    --highlighted-seen-color: #111;
    --deleted-bg: #e63946;
    --text-deleted: #ccc;
    --tag: #ccc;
    --subject-color: #bbb;
    --summary-font-weight: 400;
    --mssghglght-bg: #999;
    --mssghglght-color: #ddd;
    --darkmode-icon-color: #eee;
    --bs-border-color: #cbd5e0;
    --redacted-bg: #fff;
    --redacted-color: #fff;
    --drawer-text-color: #e0e0e0;
    --drawer-heading-color: #8ab4f8;
    --drawer-section-heading-color: #aac8ff;
    --drawer-muted-color: #999999;
    --action-button-color: #8ab4f8;
    --action-button-hover-bg: rgba(138, 180, 248, 0.15);
    --action-button-hover-color: #aac8ff;
}

@font-face{
  font-family:'FontAwesome';
  src: url('/assets/font/fontawesome-webfont.woff?v=3.2.1') format('woff'),
       url('/assets/font/fontawesome-webfont.ttf?v=3.2.1') format('truetype');
  font-weight:normal;
  font-style:normal;
}

html, body { height: 100%; }

body { margin:0; font-family:"Segoe UI","Segoe WP","Helvetica Neue",sans-serif; font-size:14px; line-height:25px; }

#main { border: 1px solid var(--bs-border-color); width: 100%; height: 100%; flex: 1; align-items: center; display: flex; flex-direction: column; justify-content: center; }

/* Top Navigation Bar */
#topNav {
  width: 100%;
  background-color: var(--header-bg);
  border-bottom: 2px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 900;
  position: relative;
}

.top-nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  gap: 20px;
}

.top-nav-logo {
  flex-shrink: 0;
}

.top-nav-logo a {
  color: #ffffff;
  text-decoration: none;
}

.top-nav-search {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
}

.search-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.search-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 8px 12px;
  font-size: 14px;
}

.search-input:focus {
  outline: none;
  box-shadow: none !important;
}

.search-action-btn {
  border: none !important;
  background: transparent !important;
  color: var(--bs-body-color) !important;
  padding: 6px 10px;
  border-radius: 4px;
  transition: all 0.2s;
}

.search-action-btn:hover {
  background: rgba(0, 0, 0, 0.05) !important;
}

.search-action-btn.active {
  background: var(--header-button-bg-color) !important;
  color: var(--header-button-color) !important;
}

.ai-search-inline {
  width: 100%;
}

.audit-title {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.audit-title h5 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.audit-search-group {
  display: flex;
  align-items: center;
  gap: 0;
}

.audit-search-group .input-group-text {
  padding: 8px 12px;
}

.audit-search-input {
  flex: 1;
}

/* Dark mode for audit search */
[data-bs-theme=dark] .audit-search-group .input-group-text {
  background: transparent !important;
  border: none;
}

[data-bs-theme=dark] .audit-search-group .input-group-text i {
  color: rgba(255, 255, 255, 0.6) !important;
}

.top-nav-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-shrink: 0;
}

.nav-icon-btn {
  color: #ffffff;
  font-size: 1.2rem;
  text-decoration: none;
  transition: opacity 0.2s;
  padding: 5px;
}

.nav-icon-btn:hover {
  opacity: 0.8;
  color: #ffffff;
}

/* Contextual Action Bar */
#contextActionBar {
  width: 100%;
  background-color: var(--bs-secondary-bg);
  border-top: 1px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color);
  padding: 12px 20px;
  z-index: 899;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.action-bar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.action-btn-group {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}

.action-btn {
  padding: 8px 16px !important;
  font-size: 1.1rem;
  border-radius: 0 !important;
  transition: all 0.2s;
}

.action-btn:first-child {
  border-top-left-radius: 6px !important;
  border-bottom-left-radius: 6px !important;
}

.action-btn:last-child {
  border-top-right-radius: 6px !important;
  border-bottom-right-radius: 6px !important;
}

.action-btn:hover {
  background-color: var(--bs-tertiary-bg) !important;
  transform: translateY(-1px);
}

.action-bar-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Dark Mode Support */
[data-bs-theme=dark] #topNav {
  background-color: var(--header-bg);
  border-bottom: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

[data-bs-theme=dark] .search-input-group {
  background: rgba(255, 255, 255, 0.1);
}

[data-bs-theme=dark] .search-input {
  color: #fff;
}

[data-bs-theme=dark] .search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

[data-bs-theme=dark] .search-action-btn {
  color: #fff !important;
}

[data-bs-theme=dark] .search-action-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme=dark] #contextActionBar {
  background-color: rgba(255, 255, 255, 0.03);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Responsive Behavior */
@media (max-width: 991px) {
  .top-nav-search {
    max-width: 500px;
  }

  .action-bar-secondary {
    display: none !important;
  }
}

/* Mobile phone styles - hide search action buttons */
@media (max-width: 767px) {
  .top-nav-container {
    padding: 8px 10px;
    gap: 10px;
  }

  .top-nav-search {
    max-width: 100%;
  }

  /* Hide search action buttons on mobile to save space */
  .search-input-group .search-action-btn,
  .search-input-group button.search-action-btn,
  .search-input-group .btn.search-action-btn {
    display: none !important;
  }

  /* Keep the search input full width on mobile */
  .search-input-group {
    padding: 6px;
  }

  .search-input {
    padding: 10px 12px;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .nav-icon-btn {
    font-size: 1rem;
  }

  /* Maintain clear separator on mobile */
  #contextActionBar {
    padding: 10px;
    border-top: 1px solid var(--bs-border-color);
  }

  .action-btn {
    padding: 6px 10px !important;
    font-size: 0.9rem;
  }
}

/* Extra small phones - more aggressive hiding */
@media (max-width: 576px) {
  .search-action-btn {
    display: none !important;
  }

  .top-nav-search button {
    display: none !important;
  }

  /* But keep AI search buttons when AI mode is active */
  .ai-search-inline button {
    display: inline-block !important;
  }
}

/* Legacy header styles (kept for compatibility) */
#header { height: 45px; align-items: center; display: flex; justify-content: center; width: 100%; background-color: var(--header-bg); }
#header a { color: #ffffff; }
#header .middlebutton { margin-top: 0px; background-color: var(--header-button-bg-color); color: var(--header-button-color); border: var(--header-button-border);}

.shistory { margin-right:-10px; border-radius: 0px!important; }

#middlebox { flex: 1; width: 100%; align-items: center; display: flex; justify-content: center; overflow-y: auto; }
#searchresults { border: 1px solid var(--bs-border-color); width: 25%; height: 100%; min-width: 150px; align-items: center; display: flex; justify-content: center; overflow-x: hidden; overflow-y: auto; }
.wrapper { border: 1px solid var(--bs-border-color); display: flex; flex-direction: column; height: 100%; width: 100%; }
.upperbox { min-height: 80px; height: auto; }
.uppercolumn { height: 45px; }

#searchresultsbox { flex-grow: 1; overflow-y: auto; padding: 8px; }

#preview { border: 1px solid var(--bs-border-color); flex: 1; height: 100%; min-width: 150px; align-items: center; display: flex; flex-direction: column; justify-content: center; overflow-x: hidden; overflow-y: auto; }
#footer { border: 1px solid var(--bs-border-color); height: 30px; width: 100%; align-items: center; display: flex; justify-content: center; }
#footer .darkmode { max-width: 80px; }

.verticalbox { flex-grow: 1; overflow-x: none; overflow-y: auto; }
.summarybox { border: 1px solid var(--bs-border-color); font-weight:var(--summary-font-weight); overflow-x: hidden;}
.nouserselect { user-select: none; -webkit-user-select: none; -moz-user-select: none; }
.summarybox a { color: var(--subject-color);}
.subject { text-decoration: underline;}
.highlighted, .highlighted a {background: var(--highlighted-bg);color:var(--highlighted-color);font-weight:400;}
.highlighted.seen, .highlighted.seen a {background: var(--highlighted-seen-bg);color:var(--highlighted-seen-color);font-weight:400;font-style:italic;}
.seen, .seen a {font-style:italic;font-weight:400;color:var(--seen);}
.selected {background:var(--selected-bg); color:var(--selected-color);}
.deleted {background: var(--deleted-bg);}

/* Search Result Card Component */
.search-result-card {
  background: var(--bs-body-bg);
  border: 2px solid var(--bs-border-color);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.search-result-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
  border-color: var(--my-blue);
}

.search-result-card .card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.search-result-card .sender-name {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.search-result-card .message-date {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  margin-left: 12px;
  flex-shrink: 0;
  text-align: right;
}

.search-result-card .subject-link {
  color: var(--subject-color);
  text-decoration: underline;
  font-size: 13px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-card .message-size {
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  flex: 1;
}

.search-result-card .indicators {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  flex-shrink: 0;
}

.search-result-card.card-highlighted {
  background: var(--highlighted-bg) !important;
  border-color: var(--highlighted-color);
  box-shadow: 0 0 0 2px var(--highlighted-color);
}

.search-result-card.card-highlighted .sender-name,
.search-result-card.card-highlighted .subject-link,
.search-result-card.card-highlighted .message-size,
.search-result-card.card-highlighted .message-date {
  color: var(--highlighted-color) !important;
}

.search-result-card.card-selected {
  background: var(--selected-bg) !important;
  border-color: var(--selected-color);
  box-shadow: 0 0 0 2px rgba(46, 139, 204, 0.3);
}

.search-result-card.card-selected .sender-name,
.search-result-card.card-selected .subject-link,
.search-result-card.card-selected .message-size {
  color: var(--selected-color) !important;
}

.search-result-card.card-seen {
  font-style: italic;
  opacity: 0.8;
}

.search-result-card.card-seen .sender-name,
.search-result-card.card-seen .subject-link {
  color: var(--seen) !important;
}

.search-result-card.card-highlighted.card-seen .sender-name,
.search-result-card.card-highlighted.card-seen .subject-link {
  color: var(--highlighted-color) !important;
  font-style: italic;
}

.search-result-card.card-deleted {
  background: var(--deleted-bg) !important;
  opacity: 0.7;
}

[data-bs-theme=dark] .search-result-card {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

[data-bs-theme=dark] .search-result-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

[data-bs-theme=dark] .search-result-card.card-selected {
  box-shadow: 0 0 0 2px rgba(187, 187, 187, 0.3);
}

/* Preview Pane Styling */
#previewbox {
  width: 100%;
  max-width: 100%;
  line-height: 1.6;
  box-sizing: border-box;
}

.verticalbox.container-fluid {
  padding-left: 15px;
  padding-right: 15px;
  width: 100%;
  max-width: 100%;
}

#previewbox iframe,
#previewbox .preview-container {
  width: 100% !important;
  max-width: 100% !important;
}

#previewbox .message-header-section {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#previewbox .message-header-section strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--bs-body-color);
}

#previewbox .message-header-section strong:first-child {
  font-size: 16px;
  color: var(--bs-primary);
  margin-bottom: 12px;
}

#previewbox .attachments-section {
  background: var(--bs-secondary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

#previewbox .attachments-section > div {
  padding: 4px 0;
}

#previewbox .attachments-section a {
  color: var(--bs-link-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

#previewbox .attachments-section a:hover {
  color: var(--bs-link-hover-color);
  text-decoration: underline;
}

#previewbox .attachments-section i {
  margin-right: 6px;
  color: var(--bs-primary);
}

#previewbox .badge {
  font-size: 12px;
  padding: 4px 10px;
  font-weight: 500;
  border-radius: 6px;
}

#previewbox hr {
  margin: 20px 0;
  opacity: 0.3;
}

#previewbox .external-warning,
#previewbox .truncated-warning {
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  border-left: 4px solid;
  font-size: 14px;
}

#previewbox .external-warning {
  background-color: #fff3cd;
  border-color: #ffc107;
  color: #856404;
}

#previewbox .truncated-warning {
  background-color: #f8d7da;
  border-color: #dc3545;
  color: #842029;
}

[data-bs-theme=dark] #previewbox .message-header-section {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-bs-theme=dark] #previewbox .message-header-section strong:first-child {
  color: #8ab4f8;
}

[data-bs-theme=dark] #previewbox .external-warning {
  background-color: #3a3000;
  border-color: #ffc107;
  color: #ffecb5;
}

[data-bs-theme=dark] #previewbox .truncated-warning {
  background-color: #2c0b0e;
  border-color: #dc3545;
  color: #ea868f;
}

/* Modern Toolbar Styling */
.preview-toolbar {
  background: var(--bs-secondary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  padding: 10px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
}

.preview-toolbar .toolbar-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--bs-link-color);
  text-decoration: none;
  transition: all 0.2s;
  padding: 4px 8px;
  border-radius: 4px;
}

.preview-toolbar .toolbar-action:hover {
  background: var(--bs-tertiary-bg);
  color: var(--bs-link-hover-color);
}

.preview-toolbar .toolbar-action i {
  font-size: 14px;
}

.preview-toolbar .toolbar-separator {
  height: 20px;
  width: 1px;
  background: var(--bs-border-color);
  margin: 0 4px;
}

.preview-toolbar .toolbar-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bs-body-bg);
}

.preview-toolbar .toolbar-notes {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.preview-toolbar .toolbar-notes input {
  border: 1px solid var(--bs-border-color);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  min-width: 200px;
}

.preview-toolbar .toolbar-notes input:focus {
  outline: none;
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 2px rgba(46, 139, 204, 0.2);
}

.preview-toolbar .toolbar-notes .btn-sm {
  padding: 4px 12px;
  font-size: 13px;
}

.preview-toolbar .dropdown-toggle {
  text-decoration: none;
}

[data-bs-theme=dark] .preview-toolbar {
  background: rgba(255, 255, 255, 0.03);
}

/* Skeleton Loader */
#preview-skeleton,
#search-results-skeleton,
#audit-preview-skeleton {
  animation: fadeIn 0.3s ease-in;
}

#preview-skeleton .placeholder,
#search-results-skeleton .placeholder,
#audit-preview-skeleton .placeholder {
  background-color: var(--bs-secondary-bg);
  border-radius: 4px;
  opacity: 0.8;
}

#preview-skeleton .placeholder-glow .placeholder,
#search-results-skeleton .placeholder-glow .placeholder,
#audit-preview-skeleton .placeholder-glow .placeholder {
  animation: placeholder-glow 2s ease-in-out infinite;
}

#preview-skeleton .placeholder-wave .placeholder,
#search-results-skeleton .placeholder-wave .placeholder,
#audit-preview-skeleton .placeholder-wave .placeholder {
  animation: placeholder-wave 2s linear infinite;
  background: linear-gradient(
    90deg,
    var(--bs-secondary-bg) 0%,
    var(--bs-tertiary-bg) 50%,
    var(--bs-secondary-bg) 100%
  );
  background-size: 200% 100%;
}

/* Preview Skeleton Specific Sizes */
#preview-skeleton .skeleton-title {
  height: 24px;
}

#preview-skeleton .skeleton-text {
  height: 18px;
}

#preview-skeleton .skeleton-body-line {
  height: 16px;
}

#preview-skeleton .skeleton-badge {
  width: 80px;
  height: 24px;
}

#preview-skeleton .skeleton-badge-md {
  width: 100px;
  height: 24px;
}

#preview-skeleton .skeleton-badge-sm {
  width: 90px;
  height: 24px;
}

/* Search Results Skeleton */
.search-skeleton-card {
  background: var(--bs-body-bg);
  border: 2px solid var(--bs-border-color);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.search-skeleton-card .skeleton-sender {
  height: 14px;
  width: 60%;
}

.search-skeleton-card .skeleton-date {
  height: 11px;
  width: 80px;
}

.search-skeleton-card .skeleton-subject {
  height: 13px;
  width: 80%;
}

.search-skeleton-card .skeleton-size {
  height: 12px;
  width: 50px;
}

.search-skeleton-card .skeleton-icons {
  height: 14px;
  width: 100px;
}

@keyframes placeholder-glow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes placeholder-wave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

[data-bs-theme=dark] #preview-skeleton .placeholder,
[data-bs-theme=dark] #search-results-skeleton .placeholder,
[data-bs-theme=dark] #audit-preview-skeleton .placeholder {
  background-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme=dark] #preview-skeleton .placeholder-wave .placeholder,
[data-bs-theme=dark] #search-results-skeleton .placeholder-wave .placeholder,
[data-bs-theme=dark] #audit-preview-skeleton .placeholder-wave .placeholder {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.06) 100%
  );
  background-size: 200% 100%;
}

[data-bs-theme=dark] .search-skeleton-card {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Drawer Component */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.show {
  display: block;
  opacity: 1;
}

.drawer {
  position: fixed;
  top: 0;
  right: -500px;
  width: 500px;
  max-width: 90vw;
  height: 100%;
  background: var(--bs-body-bg);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.2);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  overflow: hidden;
}

.drawer.drawer-wide {
  right: -800px;
  width: 800px;
  max-width: 95vw;
}

.drawer.drawer-extra-wide {
  right: -1000px;
  width: 1000px;
  max-width: 95vw;
}

.drawer.show {
  right: 0;
}

.drawer-header {
  padding: 20px;
  border-bottom: 1px solid var(--bs-border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--bs-secondary-bg);
}

.drawer-header h5 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--bs-body-color);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.drawer-close:hover {
  background: var(--bs-tertiary-bg);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--bs-border-color);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-shrink: 0;
  background: var(--bs-secondary-bg);
}

[data-bs-theme=dark] .drawer {
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.6);
}

[data-bs-theme=dark] .drawer-backdrop {
  background-color: rgba(0, 0, 0, 0.7);
}

.resizer[data-direction='horizontal'] { background-color: #2e8bcc; cursor: ew-resize; height: 100%; width: 5px; }
.resizer[data-direction='vertical'] { background-color: #cbd5e0; cursor: ns-resize; height: 5px; width: 100%; }

.navbar { background-color: #2c5fc4; font-family:"Segoe UI Light","Helvetica Neue","Segoe UI","Segoe WP",sans-serif;font-weight:100;text-transform:lowercase;font-size:25px;}

.ps10 { padding-left: 10px; }
.ps20 { padding-left: 20px; }
.ps30 { padding-left: 30px; }
.pe10 { padding-right: 10px; }

.text-tag { color: var(--tag); }
.text-tag.highlighted { color: var(--highlighted-color); }
.text-myblue { color: var(--my-blue); }
.text-deleted { color: var(--text-deleted); }
.mssghglght { background:var(--mssghglght-bg); color:var(--mssghglght-color);}

.brand { padding-right: 10px; margin-top: -5px; }

#mynote { height: 20px; }

input,button,select,textarea{font-family:"Segoe UI","Segoe WP","Helvetica Neue",sans-serif; background-color: var(--header-body-bg);border: 1px solid var(--bs-border-color);}

.middlebuttons { width: 40%; }
.text-darkmode-icon { color: var(--darkmode-icon-color); }

.loginbox { width: 300px; text-transform:lowercase; }
.login-logo { margin-top: 30px; margin-bottom: 30px; width: 148px; height: 70px; }
.header-logo { height: 35px; margin-left: -10px; padding-right: 10px; }

@media (max-width: 1199px) {
  .lefticons { width: 80%; font-size: 1rem; }
  .righticons { width: 20%; font-size: 1rem; }
  .icon-padding { padding-right: 10px; }
}

@media (min-width: 1200px) {
  .lefticons { width: 40%; font-size: 1.5rem; }
  .righticons { width: 20%; font-size: 1.5rem; }
  .icon-padding { padding-right: 20px; }
}

@media (min-width: 768px) {
  .login-logo { width: 295px; height: 140px; }
}

.modal {font-size:12px; }
.toast-logo { width:32px; }

.modal-body h4 {padding-top: 10px;}

.admin {border: 1px solid var(--bs-border-color); height: 100%; width: 1400px; align-items: center; justify-content: center; overflow-x: auto; overflow-y: auto;}

.piechart {position: relative; width:400px; height:400px;}
.linechart {position: relative; width:600px; height:300px;}

.help1 {font-size: 16px;}
.help2 {color: var(--selected-color);}

.myspinner {width: 5rem; height: 5rem;}
.middleofscreen {position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);}
.hidden {visibility: hidden;}
.active {font-weight:400;}
.ms5 {margin-left: 5px;}

.img404 {height: 450px;}

.redacted {color:var(--redacted-color); background:var(--redacted-bg);}

.external-warning { color:red; font-size: 1.5rem; }
.truncated-warning { color:#FF5733; font-size: 1.5rem; }

h1.h3.mb-3.fw-normal {text-align: center;}

tr.text-success td {
  color: #198754; /* Bootstrap success color */
}
tr.text-danger td {
  color: #dc3545; /* Bootstrap danger color */
}

.clickable {
  cursor: pointer;
}

/* Audit Dashboards */
#failedLoginChart {
  height: 250px;
}

#activityTimelineChart {
  height: 250px;
}

#actionDistributionChart {
  height: 300px;
}

.no-timeline-icon,
.no-message-icon {
  font-size: 3rem;
}

/* Deduplication Dashboard */
.deduplication-dashboard {
  padding: 20px;
}

.dashboard-header {
  margin-bottom: 30px;
}

.dashboard-header h4 {
  margin-bottom: 5px;
  font-weight: 600;
}

.stat-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  height: 100%;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
  margin-bottom: 5px;
  text-transform: uppercase;
  font-weight: 600;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--bs-body-color);
  line-height: 1.2;
}

.stat-subtext {
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
  margin-top: 5px;
}

.chart-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: 20px;
  height: 100%;
}

.chart-card h5 {
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 1.1rem;
}

.distribution-legend {
  margin-top: 15px;
}

.attachment-stat {
  text-align: center;
  padding: 15px;
}

.attachment-stat .label {
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
  margin-bottom: 8px;
  text-transform: uppercase;
  font-weight: 600;
}

.attachment-stat .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bs-body-color);
}

.attachment-stat .subtext {
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
  margin-top: 5px;
}

/* Storage Insights Dashboard */
.storage-insights {
  padding: 20px;
}

.insight-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.insight-card h5 {
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 1.1rem;
}

.insight-card .table {
  margin-bottom: 0;
}

.insight-card .table th {
  background: var(--bs-body-bg);
  border-bottom: 2px solid var(--bs-border-color);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}

.insight-card .table td {
  vertical-align: middle;
}

.recommendations-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.recommendations-card h5 {
  color: white;
}

.recommendation-item {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  padding: 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin-bottom: 15px;
}

.recommendation-icon {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  flex-shrink: 0;
}

.recommendation-content h6 {
  margin-bottom: 5px;
  font-weight: 600;
  color: white;
}

.recommendation-content p {
  margin: 0;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
}

/* Smart Insights Modal */
.smart-insights-modal-body {
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}

/* Modal Enhancements */
#myArchiveModal .sortable,
#exportModal .sortable,
#advancedSearchModal .sortable,
#userSettingsModal .sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
}

#myArchiveModal .sortable:hover,
#exportModal .sortable:hover,
#advancedSearchModal .sortable:hover,
#userSettingsModal .sortable:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

#myArchiveModal .sortable.sorted,
#exportModal .sortable.sorted,
#advancedSearchModal .sortable.sorted,
#userSettingsModal .sortable.sorted {
  color: #0d6efd;
  font-weight: 600;
}

#myArchiveModal .sortable .bi,
#exportModal .sortable .bi,
#advancedSearchModal .sortable .bi,
#userSettingsModal .sortable .bi {
  font-size: 0.75rem;
  opacity: 0.5;
  transition: opacity 0.2s;
}

#myArchiveModal .sortable.sorted .bi,
#exportModal .sortable.sorted .bi,
#advancedSearchModal .sortable.sorted .bi,
#userSettingsModal .sortable.sorted .bi {
  opacity: 1;
}

#myArchiveModal .card,
#exportModal .card,
#advancedSearchModal .card,
#userSettingsModal .card {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  transition: transform 0.2s;
}

#myArchiveModal .card:hover,
#advancedSearchModal .card:hover,
#userSettingsModal .card:hover {
  transform: translateY(-2px);
}

/* Export Modal Specific */
#exportModal .table-hover tbody tr:hover {
  cursor: pointer;
}

/* Advanced Search Modal Specific */
#advancedSearchModal .form-label,
#userSettingsModal .form-label {
  margin-bottom: 0.5rem;
}

#advancedSearchModal .card-header,
#userSettingsModal .card-header {
  background-color: rgba(0, 0, 0, 0.03);
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

/* User Settings Modal Specific */
#userSettingsModal .badge {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
}

/*
 * #663399: rebecca purple
 * #2e8bcc: my blue
 * #33b249: nice green
 */

/* Modal scrollable content */
.modal-scrollable-body {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

/* File icon size in modals */
.file-icon-sm {
  width: 20px;
}

/* Empty state icon for Similar Emails modal */
.similar-emails-empty-icon {
  font-size: 3rem;
}

/* Admin navbar styles */
.admin-navbar-flex {
  flex: 1;
}

.admin-nav-compact {
  font-size: 0.9rem;
}

/* Empty state icon for Related Attachments modal */
.related-attachments-empty-icon {
  font-size: 3rem;
}

/* Truncate text for attachment subject in table */
.attachment-subject-truncate {
  max-width: 200px;
}

/* Semantic Search Styles */
.semantic-search-toggle {
  font-size: 0.9rem;
}

.semantic-search-toggle .bi-magic {
  color: #bb86fc;
}

.badge.bg-info {
  background-color: #0dcaf0 !important;
}

[data-bs-theme=dark] .badge.bg-info {
  background-color: #17a2b8 !important;
  color: #fff;
}

.badge.bg-info .bi-magic {
  font-size: 0.8rem;
}

/* Semantic search score badge styling */
.semantic-score-badge {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 4px rgba(23, 162, 184, 0.3);
  transition: all 0.2s ease;
  vertical-align: middle;
  margin-right: 6px;
}

.semantic-score-badge i {
  font-size: 0.85rem;
  margin-right: 3px;
}

.semantic-score-badge:hover {
  opacity: 0.9;
  cursor: help;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(23, 162, 184, 0.4);
}

/* Dark mode - semantic score badge */
[data-bs-theme=dark] .semantic-score-badge {
  background-color: #17a2b8 !important;
  color: #000 !important;
  box-shadow: 0 2px 4px rgba(23, 162, 184, 0.5);
}

[data-bs-theme=dark] .semantic-score-badge:hover {
  box-shadow: 0 4px 8px rgba(23, 162, 184, 0.6);
}

/* Email category badge styles */
.badge.bg-purple {
  background-color: #6f42c1 !important;
  color: #fff;
}

[data-bs-theme=dark] .badge.bg-purple {
  background-color: #8b5cf6 !important;
  color: #fff;
}

/* AI Summary Modal styles */
.summary-content {
  padding: 1rem 0;
}

.summary-text {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  padding: 1.25rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

[data-bs-theme=dark] .summary-text {
  background-color: #2d3748;
  border-color: #4a5568;
}

#aiSummaryModal .modal-content {
  border-radius: 0.5rem;
}

#aiSummaryModal .modal-header {
  background-color: var(--header-bg);
  color: white;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

#aiSummaryModal .modal-header .btn-close {
  filter: brightness(0) invert(1);
}

[data-bs-theme=dark] #aiSummaryModal .modal-header {
  background-color: #1a202c;
  border-bottom: 1px solid #4a5568;
}

/* AI Conversational Search - Compact Inline Design */
.ai-translation-compact {
  padding: 0.25rem 0.5rem;
  background-color: transparent;
  border-left: 3px solid var(--my-blue);
  margin-left: 0.5rem;
}

.ai-translation-compact code {
  background-color: transparent;
  color: var(--my-blue);
  font-weight: 600;
  font-size: 0.85rem;
}

.ai-translation-compact .text-muted {
  color: var(--bs-secondary-color) !important;
}

/* Dark mode for compact AI search */
[data-bs-theme=dark] .ai-translation-compact {
  border-left-color: #667eea;
}

[data-bs-theme=dark] .ai-translation-compact code {
  color: #9f7aea;
}

/* Demo message styling (for long help text on demo sites) */
.demo-message-text {
  white-space: pre-wrap;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 0;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 0.25rem;
  max-height: 400px;
  overflow-y: auto;
  font-family: monospace;
}

[data-bs-theme=dark] .demo-message-text {
  background-color: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

/* Teams Search Styles */
.teams-message {
    border-left: 4px solid #0078d4;
    transition: box-shadow 0.2s;
}

.teams-message:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.message-body {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.badge.bg-info {
    background-color: #0078d4 !important;
}

/* Teams Search Layout Fixes */
#teams-search .upperbox {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bs-body-bg);
    padding: 1rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}

#teams-search #searchresultsbox {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding: 1rem;
}

/* Smooth scrolling for results */
#teams-search #searchresultsbox::-webkit-scrollbar {
    width: 8px;
}

#teams-search #searchresultsbox::-webkit-scrollbar-track {
    background: var(--bs-body-bg);
}

#teams-search #searchresultsbox::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#teams-search #searchresultsbox::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Override wrapper for Teams search - fixed height layout */
#teams-search .wrapper {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

#teams-search .upperbox {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Chat Conversation Modal */
.message-item {
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
    transition: background-color 0.3s ease;
}

.message-item:hover {
    background-color: var(--bs-secondary-bg);
}

/* Highlighted message (works in light and dark mode) */
.highlighted-message {
    background-color: rgba(255, 193, 7, 0.2) !important; /* Yellow tint for light mode */
    border-left: 4px solid #ffc107 !important;
    animation: highlight-pulse 2s ease-in-out;
}

/* Dark mode support */
[data-bs-theme="dark"] .highlighted-message {
    background-color: rgba(255, 193, 7, 0.15) !important; /* Dimmer yellow for dark mode */
    border-left: 4px solid #ffc107 !important;
}

/* Pulse animation for highlighted message */
@keyframes highlight-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Conversation modal scroll styling */
#chatConversationModal .modal-body::-webkit-scrollbar {
    width: 8px;
}

#chatConversationModal .modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#chatConversationModal .modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================================================
   SMART INSIGHTS MODERNIZATION - PHASE 1
   Modern dashboard styling for Smart Insights audit page
   ======================================================================== */

/* 1. MODERN TAB STYLING - Pill-style segmented tabs
   -------------------------------------------------------------------- */
.nav-tabs {
  border-bottom: 2px solid var(--bs-border-color);
  margin-bottom: 0;
  gap: 8px;
}

.nav-tabs .nav-link {
  cursor: pointer;
  color: var(--bs-secondary-color);
  border: 1px solid var(--bs-border-color);
  background: transparent;
  padding: 10px 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-weight: 500;
  margin-bottom: -2px;
}

.nav-tabs .nav-link i {
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

.nav-tabs .nav-link:hover {
  background: var(--bs-secondary-bg);
  border-color: var(--bs-primary);
  color: var(--bs-body-color);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-tabs .nav-link.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--bs-primary) 0%, #1e4db7 100%);
  border-color: var(--bs-primary);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(46, 139, 204, 0.3);
  transform: translateY(-2px);
}

.nav-tabs .nav-link.active i {
  transform: scale(1.1);
}

[data-bs-theme=dark] .nav-tabs .nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-bs-theme=dark] .nav-tabs .nav-link.active {
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

/* 2. ENHANCED KPI DASHBOARD CARDS
   -------------------------------------------------------------------- */
.pii-card {
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  overflow: hidden;
}

.pii-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.pii-card .card-body {
  padding: 24px 20px;
}

/* Enhanced color coding for KPI cards */
.pii-total {
  border-left: 5px solid #dc3545;
  background: linear-gradient(135deg, #ffffff 0%, #fff5f5 100%);
}

.pii-credit-card {
  border-left: 5px solid #fd7e14;
  background: linear-gradient(135deg, #ffffff 0%, #fff8f0 100%);
}

.pii-ssn {
  border-left: 5px solid #ffc107;
  background: linear-gradient(135deg, #ffffff 0%, #fffbea 100%);
}

.pii-other {
  border-left: 5px solid #0dcaf0;
  background: linear-gradient(135deg, #ffffff 0%, #f0fcff 100%);
}

[data-bs-theme=dark] .pii-total {
  background: linear-gradient(135deg, #2d3748 0%, #3d2a2a 100%);
}

[data-bs-theme=dark] .pii-credit-card {
  background: linear-gradient(135deg, #2d3748 0%, #3d3428 100%);
}

[data-bs-theme=dark] .pii-ssn {
  background: linear-gradient(135deg, #2d3748 0%, #3d3828 100%);
}

[data-bs-theme=dark] .pii-other {
  background: linear-gradient(135deg, #2d3748 0%, #283a3d 100%);
}

.card-icon {
  font-size: 3rem;
  opacity: 0.9;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.card-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 12px 0;
  color: var(--bs-body-color);
  letter-spacing: -0.5px;
}

.card-label {
  font-size: 0.95rem;
  color: var(--bs-secondary-color);
  margin: 0;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 3. SPACING AND GROUPING - Better visual hierarchy
   -------------------------------------------------------------------- */
.px-3.pt-4.pb-4 {
  padding-top: 32px !important;
  padding-bottom: 32px !important;
}

/* Vertical spacing between sections */
.row.mb-4 {
  margin-bottom: 32px !important;
}

.card + .card {
  margin-top: 24px;
}

/* 4. SCANNER STATUS BLOCK - Enhanced container
   -------------------------------------------------------------------- */
.scanner-status-card {
  border-left: 5px solid var(--bs-primary);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  transition: all 0.3s ease;
}

.scanner-status-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

[data-bs-theme=dark] .scanner-status-card {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.scanner-status-card .card-body {
  padding: 24px;
}

.scanner-status-card .card-title {
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--bs-body-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.scanner-status-card .row.align-items-center {
  gap: 16px;
}

.status-indicator {
  text-align: center;
  padding: 8px;
}

.status-indicator span {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.stat-box {
  text-align: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  transition: background 0.2s ease;
}

.stat-box:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-bs-theme=dark] .stat-box {
  background: rgba(255, 255, 255, 0.03);
}

[data-bs-theme=dark] .stat-box:hover {
  background: rgba(255, 255, 255, 0.06);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--bs-body-color);
}

/* 5. TABLE VISUAL IMPROVEMENTS - Better readability
   -------------------------------------------------------------------- */
.card .table {
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.card .table thead th {
  background: var(--bs-secondary-bg);
  border-bottom: 2px solid var(--bs-border-color);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
  padding: 16px 12px;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.card .table tbody td {
  vertical-align: middle;
  padding: 16px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Zebra striping for better readability */
.card .table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.02);
}

[data-bs-theme=dark] .card .table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Hover effect for interactive rows */
.card .table-hover tbody tr {
  transition: all 0.2s ease;
}

.card .table-hover tbody tr:hover {
  background-color: rgba(46, 139, 204, 0.08);
  transform: scale(1.01);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-bs-theme=dark] .card .table-hover tbody tr:hover {
  background-color: rgba(74, 144, 226, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Enhanced table container */
.card .card-body .table-responsive {
  border-radius: 8px;
  overflow: hidden;
}

/* 6. DETECTION BREAKDOWN CARD - Enhanced styling
   -------------------------------------------------------------------- */
.card .card-title {
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--bs-body-color);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--bs-border-color);
}

.card .card-title i {
  font-size: 1.3rem;
  color: var(--bs-primary);
}

/* Progress bar enhancements */
.progress {
  background-color: rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  overflow: hidden;
}

[data-bs-theme=dark] .progress {
  background-color: rgba(255, 255, 255, 0.1);
}

.progress-bar {
  background: linear-gradient(90deg, var(--bs-primary) 0%, #1e4db7 100%);
  font-weight: 600;
  font-size: 0.85rem;
  transition: width 0.6s ease;
}

/* 7. GENERAL CARD IMPROVEMENTS - Modern card design
   -------------------------------------------------------------------- */
.card {
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  overflow: hidden;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

[data-bs-theme=dark] .card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-bs-theme=dark] .card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.card .card-body {
  padding: 24px;
}

/* 8. BUTTON AND BADGE IMPROVEMENTS - Modern styling
   -------------------------------------------------------------------- */
.btn-primary {
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(46, 139, 204, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46, 139, 204, 0.4);
}

.badge {
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.3px;
}

/* 9. RESPONSIVE ADJUSTMENTS - Mobile-friendly spacing
   -------------------------------------------------------------------- */
@media (max-width: 768px) {
  .nav-tabs .nav-link {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .card-value {
    font-size: 2rem;
  }

  .card-icon {
    font-size: 2.5rem;
  }

  .card .card-body {
    padding: 16px;
  }

  .scanner-status-card .card-body {
    padding: 16px;
  }
}

/* ========================================================================
   SMART INSIGHTS MODERNIZATION - PHASE 2
   Enhanced table structure, alignment, and component polish
   ======================================================================== */

/* 1. SEGMENTED TAB BAR - Tabs touch each other as single component
   -------------------------------------------------------------------- */
.nav-tabs {
  display: flex;
  gap: 0; /* Remove gap so tabs touch */
  border-bottom: 2px solid var(--bs-border-color);
  padding: 0;
  background: transparent;
}

.nav-tabs .nav-item {
  margin: 0;
}

.nav-tabs .nav-link {
  border-radius: 0; /* Remove border radius from middle tabs */
  margin-bottom: -2px;
  margin-left: -1px; /* Overlap borders so tabs share borders */
  position: relative;
}

.nav-tabs .nav-link:first-child {
  border-top-left-radius: 8px; /* Round left edge */
  border-bottom-left-radius: 8px;
  margin-left: 0;
}

.nav-tabs .nav-link:last-child {
  border-top-right-radius: 8px; /* Round right edge */
  border-bottom-right-radius: 8px;
}

.nav-tabs .nav-link.active {
  z-index: 2; /* Bring active tab above others */
  border-bottom-color: transparent;
}

.nav-tabs .nav-link:not(.active) {
  z-index: 1;
}

/* 2. TABLE ALIGNMENT IMPROVEMENTS - Right-align numeric columns
   -------------------------------------------------------------------- */
/* Detection Breakdown Table - Numeric columns right-aligned */
.card .table thead th:nth-child(2),
.card .table thead th:nth-child(3) {
  text-align: right;
}

.card .table tbody td:nth-child(2),
.card .table tbody td:nth-child(3) {
  text-align: right;
}

/* Recent Detections Table - Specific column alignments */
.card .table thead th:nth-child(4), /* Confidence */
.card .table thead th:nth-child(5), /* Detected */
.card .table thead th:nth-child(6) { /* Actions */
  text-align: right;
}

.card .table tbody td:nth-child(4), /* Confidence */
.card .table tbody td:nth-child(5), /* Detected */
.card .table tbody td:nth-child(6) { /* Actions */
  text-align: right;
}

/* Keep Type column left-aligned with icon */
.card .table tbody td:nth-child(1) {
  text-align: left;
}

/* 3. STICKY TABLE HEADERS - Headers stay visible when scrolling
   -------------------------------------------------------------------- */
.card .table thead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bs-secondary-bg);
}

.card .table thead th {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bs-secondary-bg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

[data-bs-theme=dark] .card .table thead th {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Add scrollable container for tables */
.card .card-body .table-container {
  max-height: 600px;
  overflow-y: auto;
  position: relative;
}

/* 4. ENHANCED STATUS BADGES - Color-coded status indicators
   -------------------------------------------------------------------- */
.scanner-status-card .status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
}

.scanner-status-card .status-indicator span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.95rem;
  letter-spacing: 1px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.scanner-status-card .status-indicator span:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Add icons to status badges using ::before */
.status-running::before {
  content: "●";
  font-size: 1.2rem;
  animation: pulse 2s ease-in-out infinite;
}

.status-idle::before {
  content: "○";
  font-size: 1.2rem;
}

.status-error::before {
  content: "✕";
  font-size: 1rem;
}

.status-paused::before {
  content: "⏸";
  font-size: 1rem;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 5. DETECTION BREAKDOWN TABLE - Enhanced visual indicators
   -------------------------------------------------------------------- */
/* Add small bar indicator before percentage column */
.card .table tbody td:nth-child(3) .progress {
  min-width: 150px;
  margin-left: auto;
}

/* Type icons sizing and spacing */
.card .table tbody td i {
  margin-right: 8px;
  font-size: 1.1rem;
}

/* Better badge styling in tables */
.card .table .badge {
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 5px;
  white-space: nowrap;
}

/* 6. RECENT DETECTIONS TABLE - Enhanced button styling
   -------------------------------------------------------------------- */
.card .table .btn-sm {
  padding: 6px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.card .table .btn-outline-primary {
  border-width: 2px;
}

.card .table .btn-outline-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(46, 139, 204, 0.3);
}

/* Dark mode button overrides - Only for outline buttons */
[data-bs-theme=dark] .btn-outline-primary {
  color: var(--action-button-color);
  border-color: var(--action-button-color);
  background-color: transparent;
}

[data-bs-theme=dark] .btn-outline-primary:hover {
  color: var(--action-button-hover-color);
  background-color: var(--action-button-hover-bg);
  border-color: var(--action-button-hover-color);
  box-shadow: 0 4px 8px rgba(138, 180, 248, 0.3);
}

[data-bs-theme=dark] .btn-outline-primary:focus,
[data-bs-theme=dark] .btn-outline-primary:active {
  color: var(--action-button-hover-color);
  background-color: var(--action-button-hover-bg);
  border-color: var(--action-button-hover-color);
}

/* Note: Removed .btn-primary dark mode override to use Bootstrap's native colors */

/* Code samples styling */
.card .table code {
  background: rgba(0, 0, 0, 0.05);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--bs-code-color, #d63384);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-bs-theme=dark] .card .table code {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #ff79c6;
}

/* 7. CARD TITLE BAR ENHANCEMENTS - Better header styling
   -------------------------------------------------------------------- */
.card .card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--bs-border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.card .card-title > span,
.card .card-title > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.card .card-title .float-end {
  margin-left: auto;
}

.card .card-title .form-select {
  min-width: 150px;
  border-radius: 6px;
  border: 2px solid var(--bs-border-color);
  padding: 6px 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.card .card-title .form-select:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(46, 139, 204, 0.15);
}

/* 8. SCANNER STATUS METRICS GRID - Better stat box layout
   -------------------------------------------------------------------- */
.scanner-status-card .row.align-items-center > div {
  padding: 8px;
}

.scanner-status-card .stat-box {
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.scanner-status-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.scanner-status-card .btn-primary {
  width: 100%;
  padding: 12px 20px;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.scanner-status-card .btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(46, 139, 204, 0.4);
}

/* 9. PII SUMMARY CARDS - Enhanced KPI card grid
   -------------------------------------------------------------------- */
.row.mb-4 .col-md-3 {
  display: flex;
  margin-bottom: 16px;
}

.pii-card {
  width: 100%;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pii-card .card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
}

/* 10. EMPTY STATE STYLING - Better empty table messages
   -------------------------------------------------------------------- */
.card .table tbody td.text-center.text-muted {
  padding: 40px 20px;
  font-size: 1.1rem;
  font-style: italic;
  background: rgba(0, 0, 0, 0.02);
}

[data-bs-theme=dark] .card .table tbody td.text-center.text-muted {
  background: rgba(255, 255, 255, 0.02);
}

/* 11. ALERT STYLING IN CARDS - Info alerts below tables
   -------------------------------------------------------------------- */
.card .alert {
  border-radius: 8px;
  border-left: 4px solid;
  font-weight: 500;
  padding: 12px 16px;
}

.card .alert-info {
  background: linear-gradient(135deg, #d1ecf1 0%, #c3e6ec 100%);
  border-left-color: #0dcaf0;
}

[data-bs-theme=dark] .card .alert-info {
  background: linear-gradient(135deg, #1a3d47 0%, #154854 100%);
  color: #9eeaf9;
}

/* 12. RESPONSIVE GRID ADJUSTMENTS - Better mobile layout
   -------------------------------------------------------------------- */
@media (max-width: 992px) {
  /* Stack KPI cards on tablets */
  .row.mb-4 .col-md-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

@media (max-width: 768px) {
  /* Single column on mobile */
  .row.mb-4 .col-md-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Simplify scanner status on mobile */
  .scanner-status-card .row.align-items-center {
    flex-direction: column;
  }

  .scanner-status-card .row.align-items-center > div {
    flex: 0 0 100%;
    max-width: 100%;
    margin-bottom: 12px;
  }

  /* Hide less critical columns on mobile */
  .card .table th:nth-child(3),
  .card .table td:nth-child(3) {
    display: none; /* Hide redacted sample column */
  }

  /* Make tabs smaller on mobile */
  .nav-tabs .nav-link {
    font-size: 0.85rem;
    padding: 8px 12px;
  }

  .nav-tabs .nav-link i {
    font-size: 1rem;
  }
}

/* 13. PROGRESS BAR ENHANCEMENTS - Better visual indicators
   -------------------------------------------------------------------- */
.card .table .progress {
  height: 24px;
  border-radius: 6px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.card .table .progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #2c5fc4 0%, #1e4db7 100%);
  box-shadow: 0 2px 4px rgba(46, 139, 204, 0.3);
}

/* 14. TABLE OVERFLOW HANDLING - Horizontal scroll on small screens
   -------------------------------------------------------------------- */
.card .table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.card .table-responsive::-webkit-scrollbar {
  height: 8px;
}

.card .table-responsive::-webkit-scrollbar-track {
  background: var(--bs-secondary-bg);
  border-radius: 4px;
}

.card .table-responsive::-webkit-scrollbar-thumb {
  background: var(--bs-border-color);
  border-radius: 4px;
}

.card .table-responsive::-webkit-scrollbar-thumb:hover {
  background: var(--bs-primary);
}

/* 15. FILTER SELECT STYLING - Better dropdown in card titles
   -------------------------------------------------------------------- */
.card .card-title select.form-select {
  background-color: var(--bs-body-bg);
  border: 2px solid var(--bs-border-color);
  color: var(--bs-body-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.card .card-title select.form-select:hover {
  border-color: var(--bs-primary);
  box-shadow: 0 2px 6px rgba(46, 139, 204, 0.2);
}

[data-bs-theme=dark] .card .card-title select.form-select {
  background-color: #2d3748;
}

/* 16. ICON CONSISTENCY - Standardize icon sizes in tables
   -------------------------------------------------------------------- */
.card .table i.bi {
  font-size: 1.1rem;
  vertical-align: middle;
}

.card .table .badge i.bi {
  font-size: 0.85rem;
  margin-right: 4px;
}

/* 17. LOADING STATE - Spinner and loading message styling
   -------------------------------------------------------------------- */
.spinner-border {
  width: 3rem;
  height: 3rem;
  border-width: 0.3rem;
}

.text-center.py-5 {
  padding: 60px 20px;
}

.text-center.py-5 p {
  font-size: 1.1rem;
  color: var(--bs-secondary-color);
  font-weight: 500;
  margin-top: 20px;
}

/* ========================================================================
   SMART INSIGHTS MODERNIZATION - PHASE 3
   Advanced UI polish, unified card system, and final visual refinements
   ======================================================================== */

/* 1. UNIFIED CARD COMPONENT SYSTEM - Base class for all insight cards
   -------------------------------------------------------------------- */
.insights-card,
.card.scanner-status-card,
.card.pii-card,
.card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 24px;
  margin-bottom: 28px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.insights-card:hover,
.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

[data-bs-theme=dark] .insights-card,
[data-bs-theme=dark] .card {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-bs-theme=dark] .insights-card:hover,
[data-bs-theme=dark] .card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* 2. UNIFIED SECTION TITLE STYLING - Consistent headers across all cards
   -------------------------------------------------------------------- */
.insights-section-title,
.card .card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  color: #1a1a1a;
  border-bottom: 2px solid var(--bs-border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
}

[data-bs-theme=dark] .insights-section-title,
[data-bs-theme=dark] .card .card-title {
  color: #e8e8e8;
}

.insights-section-title i,
.card .card-title i {
  font-size: 1.4rem;
  color: var(--bs-primary);
  opacity: 0.9;
}

/* 3. TRUE KPI CARD COMPONENTS - Enhanced metric cards
   -------------------------------------------------------------------- */
.kpi-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  padding: 24px 20px;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--bs-primary) 0%, #1e4db7 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-bs-theme=dark] .kpi-card {
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

/* KPI Icon styling */
.kpi-icon,
.pii-card .card-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  opacity: 0.9;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
  transition: all 0.3s ease;
}

.kpi-card:hover .kpi-icon,
.pii-card:hover .card-icon {
  transform: scale(1.1) rotateZ(5deg);
}

/* KPI Label styling */
.kpi-label,
.pii-card .card-label {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--bs-secondary-color);
  margin-bottom: 8px;
}

/* KPI Value styling */
.kpi-value,
.pii-card .card-value {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  color: var(--bs-body-color);
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
}

/* Color-coded KPI cards */
.kpi-card.kpi-total,
.pii-card.pii-total {
  border-left: 5px solid #dc3545;
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
}

.kpi-card.kpi-credit-card,
.pii-card.pii-credit-card {
  border-left: 5px solid #fd7e14;
  background: linear-gradient(135deg, #fff8f0 0%, #ffffff 100%);
}

.kpi-card.kpi-ssn,
.pii-card.pii-ssn {
  border-left: 5px solid #ffc107;
  background: linear-gradient(135deg, #fffbea 0%, #ffffff 100%);
}

.kpi-card.kpi-other,
.pii-card.pii-other {
  border-left: 5px solid #0dcaf0;
  background: linear-gradient(135deg, #f0fcff 0%, #ffffff 100%);
}

/* Compliance Risk Cards */
.kpi-card.kpi-compliance-low,
.kpi-card.kpi-risk-low {
  border-left: 5px solid #28a745;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.kpi-card.kpi-compliance-medium,
.kpi-card.kpi-risk-medium {
  border-left: 5px solid #ffc107;
  background: linear-gradient(135deg, #fffbea 0%, #ffffff 100%);
}

.kpi-card.kpi-compliance-high,
.kpi-card.kpi-risk-high {
  border-left: 5px solid #fd7e14;
  background: linear-gradient(135deg, #fff8f0 0%, #ffffff 100%);
}

.kpi-card.kpi-compliance-critical,
.kpi-card.kpi-risk-critical {
  border-left: 5px solid #dc3545;
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
}

[data-bs-theme=dark] .kpi-card.kpi-total,
[data-bs-theme=dark] .pii-card.pii-total {
  background: linear-gradient(135deg, #3d2a2a 0%, #2d3748 100%);
}

[data-bs-theme=dark] .kpi-card.kpi-credit-card,
[data-bs-theme=dark] .pii-card.pii-credit-card {
  background: linear-gradient(135deg, #3d3428 0%, #2d3748 100%);
}

[data-bs-theme=dark] .kpi-card.kpi-ssn,
[data-bs-theme=dark] .pii-card.pii-ssn {
  background: linear-gradient(135deg, #3d3828 0%, #2d3748 100%);
}

[data-bs-theme=dark] .kpi-card.kpi-other,
[data-bs-theme=dark] .pii-card.pii-other {
  background: linear-gradient(135deg, #283a3d 0%, #2d3748 100%);
}

/* Dark mode - Compliance and Risk Cards */
[data-bs-theme=dark] .kpi-card.kpi-compliance-low,
[data-bs-theme=dark] .kpi-card.kpi-risk-low {
  background: linear-gradient(135deg, #2a3d2a 0%, #2d3748 100%);
}

[data-bs-theme=dark] .kpi-card.kpi-compliance-medium,
[data-bs-theme=dark] .kpi-card.kpi-risk-medium {
  background: linear-gradient(135deg, #3d3828 0%, #2d3748 100%);
}

[data-bs-theme=dark] .kpi-card.kpi-compliance-high,
[data-bs-theme=dark] .kpi-card.kpi-risk-high {
  background: linear-gradient(135deg, #3d3428 0%, #2d3748 100%);
}

[data-bs-theme=dark] .kpi-card.kpi-compliance-critical,
[data-bs-theme=dark] .kpi-card.kpi-risk-critical {
  background: linear-gradient(135deg, #3d2a2a 0%, #2d3748 100%);
}

/* 4. STATUS BADGE PILLS - Modern status indicators
   -------------------------------------------------------------------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.status-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Status badge colors */
.status-badge.status-idle {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  color: #155724;
  border: 2px solid #28a745;
}

.status-badge.status-running {
  background: linear-gradient(135deg, #cce5ff 0%, #b8daff 100%);
  color: #004085;
  border: 2px solid #007bff;
}

.status-badge.status-scanning {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
  color: #856404;
  border: 2px solid #ffc107;
}

.status-badge.status-error {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  color: #721c24;
  border: 2px solid #dc3545;
}

.status-badge.status-paused {
  background: linear-gradient(135deg, #e2e3e5 0%, #d6d8db 100%);
  color: #383d41;
  border: 2px solid #6c757d;
}

/* Status badge icons */
.status-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.status-running::before {
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.7;
  }
}

[data-bs-theme=dark] .status-badge.status-idle {
  background: linear-gradient(135deg, #1e3a28 0%, #2d4a36 100%);
  color: #9effc3;
}

[data-bs-theme=dark] .status-badge.status-running {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d4a7d 100%);
  color: #9ed4ff;
}

[data-bs-theme=dark] .status-badge.status-scanning {
  background: linear-gradient(135deg, #5f4d1e 0%, #7d6a2d 100%);
  color: #fff89e;
}

[data-bs-theme=dark] .status-badge.status-error {
  background: linear-gradient(135deg, #5f1e24 0%, #7d2d35 100%);
  color: #ff9ea8;
}

/* 5. INLINE PERCENTAGE BARS - Visual data representation
   -------------------------------------------------------------------- */
.percentage-bar-cell {
  padding: 8px 12px;
}

.bar-bg {
  position: relative;
  width: 100%;
  height: 28px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-bs-theme=dark] .bar-bg {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #2c5fc4 0%, #1e4db7 100%);
  border-radius: 8px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(46, 139, 204, 0.4);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  min-width: 50px;
}

.bar-fill::after {
  content: attr(data-percentage);
}

/* Animated gradient for bars */
.bar-fill {
  background: linear-gradient(
    90deg,
    #2c5fc4 0%,
    #1e4db7 50%,
    #2c5fc4 100%
  );
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* 6. PII TYPE ICONS - Enhanced table icons
   -------------------------------------------------------------------- */
.pii-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 10px;
  border-radius: 8px;
  font-size: 1.2rem;
  background: rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

[data-bs-theme=dark] .pii-type-icon {
  background: rgba(255, 255, 255, 0.08);
}

.card .table tbody tr:hover .pii-type-icon {
  transform: scale(1.15) rotateZ(5deg);
  background: rgba(46, 139, 204, 0.15);
}

/* Specific PII type icon colors */
.pii-type-icon.icon-ssn {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
}

.pii-type-icon.icon-credit-card {
  background: rgba(253, 126, 20, 0.15);
  color: #fd7e14;
}

.pii-type-icon.icon-email {
  background: rgba(13, 202, 240, 0.15);
  color: #0dcaf0;
}

.pii-type-icon.icon-phone {
  background: rgba(25, 135, 84, 0.15);
  color: #198754;
}

.pii-type-icon.icon-iban {
  background: rgba(13, 110, 253, 0.15);
  color: #0d6efd;
}

.pii-type-icon.icon-passport {
  background: rgba(108, 117, 125, 0.15);
  color: #6c757d;
}

.pii-type-icon.icon-ip {
  background: rgba(111, 66, 193, 0.15);
  color: #6f42c1;
}

/* 7. ENHANCED ACTION BUTTONS - Modern table actions
   -------------------------------------------------------------------- */
.card .table .btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  border: 2px solid var(--bs-primary);
  background: transparent;
  color: var(--bs-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  cursor: pointer;
}

.card .table .btn-action:hover {
  background: var(--bs-primary);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(46, 139, 204, 0.3);
}

.card .table .btn-action i {
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.card .table .btn-action:hover i {
  transform: scale(1.2);
}

/* Alternative filled button style */
.card .table .btn-action.btn-action-filled {
  background: var(--bs-primary);
  color: white;
}

.card .table .btn-action.btn-action-filled:hover {
  background: #1e4db7;
  transform: translateY(-3px) scale(1.05);
}

/* 8. SCANNER STATUS METRICS LAYOUT - Two-column grid
   -------------------------------------------------------------------- */
.scanner-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.scanner-metric-box {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  transition: all 0.3s ease;
}

.scanner-metric-box:hover {
  background: rgba(46, 139, 204, 0.05);
  border-color: var(--bs-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-bs-theme=dark] .scanner-metric-box {
  background: rgba(255, 255, 255, 0.03);
}

[data-bs-theme=dark] .scanner-metric-box:hover {
  background: rgba(74, 144, 226, 0.1);
}

.scanner-metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--bs-secondary-color);
  margin-bottom: 8px;
}

.scanner-metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bs-body-color);
  font-variant-numeric: tabular-nums;
}

/* 9. MODERN TAB ICONS - Enhanced iconography
   -------------------------------------------------------------------- */
.nav-tabs .nav-link i {
  font-size: 1.2rem;
  margin-right: 6px;
  transition: all 0.3s ease;
}

.nav-tabs .nav-link.active i {
  transform: scale(1.15) rotateZ(-5deg);
  filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.3));
}

.nav-tabs .nav-link:hover i {
  transform: scale(1.1) translateY(-2px);
}

/* 10. TABLE HEADER TYPOGRAPHY - Enhanced readability
   -------------------------------------------------------------------- */
.card .table thead th {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--bs-secondary-color);
  padding: 18px 12px;
  background: linear-gradient(135deg, var(--bs-secondary-bg) 0%, var(--bs-tertiary-bg) 100%);
  border-bottom: 3px solid var(--bs-border-color);
}

.card .table thead th:first-child {
  border-top-left-radius: 8px;
}

.card .table thead th:last-child {
  border-top-right-radius: 8px;
}

/* 11. TABLE CONTAINER ELEVATION - Visual depth
   -------------------------------------------------------------------- */
.card .table-wrapper {
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  background: var(--bs-body-bg);
}

[data-bs-theme=dark] .card .table-wrapper {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 12. ROW HOVER STATES - Enhanced interactivity
   -------------------------------------------------------------------- */
.card .table tbody tr {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
}

.card .table tbody tr:hover {
  background: rgba(46, 139, 204, 0.08);
  transform: scale(1.005);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  position: relative;
  z-index: 1;
}

[data-bs-theme=dark] .card .table tbody tr:hover {
  background: rgba(74, 144, 226, 0.12);
}

/* 13. GLOBAL SPACING IMPROVEMENTS - Better breathing room
   -------------------------------------------------------------------- */
.px-3.pt-4.pb-4 {
  padding: 32px 24px !important;
}

@media (max-width: 768px) {
  .px-3.pt-4.pb-4 {
    padding: 20px 16px !important;
  }
}

/* Spacing between card sections */
.insights-card + .insights-card,
.card + .card {
  margin-top: 32px;
}

/* Row spacing within cards */
.row.mb-4 {
  margin-bottom: 28px !important;
}

/* 14. NEUTRAL COLOR PALETTE - Consistent theme
   -------------------------------------------------------------------- */
:root {
  --insights-gray-50: #f9fafb;
  --insights-gray-100: #f3f4f6;
  --insights-gray-200: #e5e7eb;
  --insights-gray-300: #d1d5db;
  --insights-gray-400: #9ca3af;
  --insights-gray-500: #6b7280;
  --insights-gray-600: #4b5563;
  --insights-gray-700: #374151;
  --insights-gray-800: #1f2937;
  --insights-gray-900: #111827;
}

[data-bs-theme=dark] {
  --insights-gray-50: #1f2937;
  --insights-gray-100: #374151;
  --insights-gray-200: #4b5563;
  --insights-gray-300: #6b7280;
  --insights-gray-400: #9ca3af;
  --insights-gray-500: #d1d5db;
  --insights-gray-600: #e5e7eb;
  --insights-gray-700: #f3f4f6;
  --insights-gray-800: #f9fafb;
  --insights-gray-900: #ffffff;
}

/* 15. CONSISTENT BORDER RADIUS - Unified design
   -------------------------------------------------------------------- */
.card,
.insights-card,
.btn,
.badge,
.form-control,
.form-select,
.progress,
.alert {
  border-radius: 10px;
}

.btn-sm,
.badge,
.status-badge {
  border-radius: 8px;
}

.pii-type-icon,
.scanner-metric-box {
  border-radius: 8px;
}

/* 16. ENHANCED BUTTON STYLES - Modern interactions
   -------------------------------------------------------------------- */
.btn-primary,
.btn-outline-primary {
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 10px 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-width: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--bs-primary) 0%, #1e4db7 100%);
  border: 2px solid transparent;
  box-shadow: 0 4px 12px rgba(46, 139, 204, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1e4db7 0%, #164191 100%);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(46, 139, 204, 0.4);
}

.btn-outline-primary:hover {
  background: var(--bs-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46, 139, 204, 0.3);
}

/* 17. LOADING SPINNER ENHANCEMENT - Better visual feedback
   -------------------------------------------------------------------- */
.spinner-border {
  width: 3.5rem;
  height: 3.5rem;
  border-width: 0.4rem;
  color: var(--bs-primary);
  animation: spinner-grow 0.75s linear infinite;
}

@keyframes spinner-grow {
  0% {
    transform: scale(0.8);
    opacity: 0.7;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.8);
    opacity: 0.7;
  }
}

/* 18. RESPONSIVE KPI GRID - Mobile-optimized layout
   -------------------------------------------------------------------- */
@media (min-width: 1200px) {
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 767px) {
  .kpi-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .kpi-card,
  .pii-card {
    min-height: 150px;
  }

  .kpi-value,
  .pii-card .card-value {
    font-size: 2.25rem;
  }
}

/* 19. PRINT STYLES - Optimized for reporting
   -------------------------------------------------------------------- */
@media print {
  .nav-tabs,
  .btn,
  .scanner-status-card .btn-primary {
    display: none;
  }

  .card,
  .insights-card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }

  .card .table {
    font-size: 10pt;
  }
}

/* 20. ACCESSIBILITY IMPROVEMENTS - Better focus states
   -------------------------------------------------------------------- */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid var(--bs-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(46, 139, 204, 0.2);
}

.card .table tbody tr:focus-within {
  background: rgba(46, 139, 204, 0.12);
  outline: 2px solid var(--bs-primary);
  outline-offset: -2px;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================================================
   SMART TEXT TRUNCATION - Ellipsis with hover tooltips
   ======================================================================== */

/* Truncatable text with ellipsis and tooltip */
.text-truncate-tooltip {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
  cursor: help;
  position: relative;
}

/* Visual indicator that text is truncated */
.text-truncate-tooltip.is-truncated {
  border-bottom: 1px dotted var(--bs-secondary-color);
}

.text-truncate-tooltip.is-truncated::after {
  content: '\2026'; /* Ellipsis character */
  position: absolute;
  right: 0;
  background: var(--bs-body-bg);
  padding-left: 4px;
}

/* Different max-widths for different contexts */
.text-truncate-sm {
  max-width: 150px;
}

.text-truncate-md {
  max-width: 250px;
}

.text-truncate-lg {
  max-width: 350px;
}

.text-truncate-xl {
  max-width: 500px;
}

/* Table cell truncation */
.table td.truncate-cell {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table td.truncate-cell-sm {
  max-width: 150px;
}

.table td.truncate-cell-md {
  max-width: 250px;
}

.table td.truncate-cell-lg {
  max-width: 350px;
}

/* Hover state for truncated cells */
.table td.truncate-cell:hover {
  overflow: visible;
  white-space: normal;
  background: var(--bs-secondary-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 100;
  max-width: none;
}

/* Native tooltip styling using title attribute */
/* Only apply help cursor to non-interactive elements with titles */
[title]:not(a):not(button):not(input):not(select):not(textarea) {
  cursor: help;
}

/* ========================================================================
   RISK DETAILS DRAWER - Wide drawer for Security Risk details
   ======================================================================== */

.risk-details-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.risk-details-drawer-backdrop.show {
  display: block;
  opacity: 1;
}

.risk-details-drawer {
  position: fixed;
  top: 0;
  right: -900px;
  width: 900px;
  max-width: 95vw;
  height: 100%;
  background: var(--bs-body-bg);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.2);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  overflow: hidden;
}

.risk-details-drawer.show {
  right: 0;
}

.risk-details-drawer-header {
  padding: 24px;
  border-bottom: 2px solid var(--bs-border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--bs-secondary-bg);
}

.risk-details-drawer-header h5 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--drawer-text-color);
}

.risk-details-drawer-header h5 i {
  font-size: 1.8rem;
  color: var(--drawer-heading-color);
}

.risk-details-drawer-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--bs-body-color);
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.risk-details-drawer-close:hover {
  background: var(--bs-tertiary-bg);
  transform: scale(1.1);
}

.risk-details-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  color: var(--drawer-text-color);
}

.risk-details-drawer-footer {
  padding: 20px 24px;
  border-top: 2px solid var(--bs-border-color);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-shrink: 0;
  background: var(--bs-secondary-bg);
}

[data-bs-theme=dark] .risk-details-drawer {
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.6);
}

[data-bs-theme=dark] .risk-details-drawer-backdrop {
  background-color: rgba(0, 0, 0, 0.7);
}

/* Drawer content styling */
.risk-details-drawer-body h6 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  margin-top: 24px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--bs-border-color);
  color: var(--drawer-section-heading-color);
}

.risk-details-drawer-body h6:first-child {
  margin-top: 0;
}

.risk-details-drawer-body .table {
  margin-bottom: 0;
}

.risk-details-drawer-body .table th {
  background: var(--bs-secondary-bg);
  font-weight: 600;
  padding: 12px;
}

.risk-details-drawer-body .table td {
  padding: 12px;
}

.risk-details-drawer-body .text-muted,
.risk-details-drawer-body .small.text-muted {
  color: var(--drawer-muted-color) !important;
}

.risk-details-drawer-body .list-group-item {
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-secondary-bg);
  transition: all 0.2s ease;
}

.risk-details-drawer-body .list-group-item:hover {
  background: var(--bs-tertiary-bg);
  transform: translateX(4px);
}

/* Risk score badge in drawer */
.risk-score-display {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bs-secondary-bg);
  border-radius: 10px;
  border: 2px solid var(--bs-border-color);
}

.risk-score-display .badge {
  font-size: 1.5rem !important;
  padding: 10px 20px;
}

/* Mobile responsive drawer */
@media (max-width: 768px) {
  .risk-details-drawer {
    width: 100vw;
    right: -100vw;
  }

  .risk-details-drawer-header {
    padding: 16px;
  }

  .risk-details-drawer-body {
    padding: 20px 16px;
  }

  .risk-details-drawer-footer {
    padding: 16px;
  }
}

/* ========================================================================
   SMART INSIGHTS PHASE 3 - CORRECTIVE STRUCTURAL CSS
   Explicit styling for new HTML structure with card containers
   ======================================================================== */

/* 1. INSIGHTS TAB BAR - Segmented control component
   -------------------------------------------------------------------- */
.insights-tab-bar {
  display: inline-flex;
  border: 2px solid var(--bs-border-color);
  border-radius: 12px;
  background: var(--bs-body-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 4px;
  gap: 4px;
  flex-shrink: 0;
}

[data-bs-theme=dark] .insights-tab-bar {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.insights-tab {
  padding: 10px 24px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--bs-body-color);
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  position: relative;
}

.insights-tab:hover:not(.active) {
  background: rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

[data-bs-theme=dark] .insights-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
}

.insights-tab.active {
  background: linear-gradient(135deg, #2b6cb0 0%, #1e4d8a 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(43, 108, 176, 0.4);
  transform: translateY(-2px);
}

[data-bs-theme=dark] .insights-tab.active {
  background: linear-gradient(135deg, var(--action-button-color) 0%, var(--action-button-hover-color) 100%);
  color: #111111;
  box-shadow: 0 2px 8px rgba(138, 180, 248, 0.5);
}

.insights-tab i {
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

.insights-tab.active i {
  transform: scale(1.1);
}

/* 2. SCANNER STATUS GRID - Organized status layout
   -------------------------------------------------------------------- */
.scanner-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.status-item {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.3s ease;
}

.status-item:hover {
  background: rgba(46, 139, 204, 0.05);
  border-color: var(--bs-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

[data-bs-theme=dark] .status-item {
  background: rgba(255, 255, 255, 0.03);
}

[data-bs-theme=dark] .status-item:hover {
  background: rgba(74, 144, 226, 0.08);
}

.status-item .stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--bs-secondary-color);
}

.status-item .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bs-body-color);
  font-variant-numeric: tabular-nums;
}

.status-item.scanner-refresh {
  grid-column: span 1;
}

.status-item.scanner-refresh button {
  width: 100%;
  padding: 12px 20px;
  font-weight: 700;
}

/* 3. KPI CARDS CONTAINER - Grid layout for metrics
   -------------------------------------------------------------------- */
.kpi-cards-container {
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

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

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

@media (max-width: 767px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* 4. KPI CARD - Individual metric card styling
   -------------------------------------------------------------------- */
.kpi-card {
  background: #fafafa;
  padding: 24px 20px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--bs-border-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 180px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--bs-primary) 0%, #1e4db7 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-bs-theme=dark] .kpi-card {
  background: rgba(255, 255, 255, 0.05);
}

.kpi-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
  transition: transform 0.3s ease;
}

.kpi-card:hover .kpi-icon {
  transform: scale(1.15) rotateZ(5deg);
}

.kpi-label {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--bs-secondary-color);
  margin-bottom: 12px;
}

.kpi-value {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  color: var(--bs-body-color);
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
}

/* Color-coded KPI cards */
.kpi-card.kpi-total {
  border-left: 5px solid #dc3545;
  background: linear-gradient(135deg, #fff5f5 0%, #fafafa 100%);
}

.kpi-card.kpi-credit-card {
  border-left: 5px solid #fd7e14;
  background: linear-gradient(135deg, #fff8f0 0%, #fafafa 100%);
}

.kpi-card.kpi-ssn {
  border-left: 5px solid #ffc107;
  background: linear-gradient(135deg, #fffbea 0%, #fafafa 100%);
}

.kpi-card.kpi-other {
  border-left: 5px solid #0dcaf0;
  background: linear-gradient(135deg, #f0fcff 0%, #fafafa 100%);
}

[data-bs-theme=dark] .kpi-card.kpi-total {
  background: linear-gradient(135deg, #3d2a2a 0%, #2d3748 100%);
}

[data-bs-theme=dark] .kpi-card.kpi-credit-card {
  background: linear-gradient(135deg, #3d3428 0%, #2d3748 100%);
}

[data-bs-theme=dark] .kpi-card.kpi-ssn {
  background: linear-gradient(135deg, #3d3828 0%, #2d3748 100%);
}

[data-bs-theme=dark] .kpi-card.kpi-other {
  background: linear-gradient(135deg, #283a3d 0%, #2d3748 100%);
}

/* 5. INSIGHTS SECTION TITLE - Unified heading style
   -------------------------------------------------------------------- */
.insights-section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  color: var(--drawer-text-color);
  border-bottom: 2px solid var(--bs-border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
}

.insights-section-title i {
  font-size: 1.4rem;
  color: var(--drawer-heading-color);
}

/* Support for filter in title */
.insights-section-title .detections-filter {
  margin-left: auto;
}

.detections-filter select {
  min-width: 150px;
  border-radius: 8px;
  border: 2px solid var(--bs-border-color);
  padding: 6px 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.detections-filter select:hover {
  border-color: var(--bs-primary);
  box-shadow: 0 2px 6px rgba(46, 139, 204, 0.2);
}

/* 6. PERCENTAGE BAR CELLS - Visual indicators in tables
   -------------------------------------------------------------------- */
.percent-bar-cell {
  padding: 12px;
  min-width: 200px;
}

.bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-bs-theme=dark] .bar-bg {
  background: rgba(255, 255, 255, 0.1);
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.4);
}

/* 7. PII TYPE ICONS - Emoji icons in tables
   -------------------------------------------------------------------- */
.pii-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 10px;
  font-size: 1.3rem;
  transition: transform 0.2s ease;
}

.table tbody tr:hover .pii-type-icon {
  transform: scale(1.2) rotateZ(5deg);
}

/* 8. BREAKDOWN CARD - Detection breakdown container
   -------------------------------------------------------------------- */
.breakdown-card .table {
  margin-bottom: 0;
}

.breakdown-card .table th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.5px;
  padding: 16px 12px;
}

.breakdown-card .table td {
  padding: 16px 12px;
  vertical-align: middle;
}

/* 9. DETECTIONS CARD - Recent detections container
   -------------------------------------------------------------------- */
.detections-card .table-responsive {
  margin-top: 16px;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  overflow: hidden;
}

.detections-card .table {
  margin-bottom: 0;
}

/* 10. RESPONSIVE ADJUSTMENTS - Mobile optimization
   -------------------------------------------------------------------- */
@media (max-width: 768px) {
  .insights-tab-bar {
    width: 100%;
    flex-direction: column;
  }

  .insights-tab {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--bs-border-color);
    justify-content: center;
  }

  .insights-tab:last-child {
    border-bottom: none;
  }

  .scanner-status-grid {
    grid-template-columns: 1fr;
  }

  .status-item.scanner-refresh {
    grid-column: span 1;
  }
}
