/* Modern SaaS Theme matching RS Agent Design */
:root {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-header: #ffffff;
  --border-light: #e2e8f0;
  --border-hover: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  --primary-navy: #0f172a;
  --primary-navy-hover: #1e293b;
  --accent-orange: #ea580c;
  --accent-orange-light: #fff7ed;
  --accent-orange-border: #fed7aa;
  
  --blue-badge-bg: #eff6ff;
  --blue-badge-text: #2563eb;
  --blue-badge-border: #bfdbfe;
  
  --green-badge-bg: #f0fdf4;
  --green-badge-text: #16a34a;
  --green-badge-border: #bbf7d0;
  
  --red-badge-bg: #fff1f2;
  --red-badge-text: #e11d48;
  --red-badge-border: #fecdd3;
  
  --amber-badge-bg: #fffbeb;
  --amber-badge-text: #d97706;
  --amber-badge-border: #fde68a;

  --purple-badge-bg: #faf5ff;
  --purple-badge-text: #9333ea;
  --purple-badge-border: #e9d5ff;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-dropdown: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Header / Navbar */
.navbar {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-navy);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary-navy);
  letter-spacing: -0.02em;
}

.brand-title span {
  color: var(--accent-orange);
}

.brand-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Nav Pills & Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--green-badge-bg);
  color: var(--green-badge-text);
  border: 1px solid var(--green-badge-border);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.avatar-badge {
  width: 26px;
  height: 26px;
  background: #111827;
  color: #fbbf24;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.avatar-badge::after {
  content: "";
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 7px;
  height: 7px;
  background: #22c55e;
  border: 1.5px solid white;
  border-radius: 50%;
}

.btn-pill-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #ffffff;
  color: #d97706;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-pill-outline:hover {
  background: #fffbeb;
  border-color: #f59e0b;
}

.btn-pill-navy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--primary-navy);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-pill-navy:hover {
  background: var(--primary-navy-hover);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-pill-blue {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-pill-blue:hover {
  background: #1d4ed8;
}

/* Page Layout */
.main-wrapper {
  max-width: 1340px;
  margin: 28px auto;
  padding: 0 24px;
}

/* Hero Banner Card */
.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 28px 36px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.hero-tag {
  color: var(--accent-orange);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.hero-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary-navy);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  line-height: 1.25;
}

.hero-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 780px;
}

.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--primary-navy);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-hero:hover {
  background: #1e293b;
  transform: translateY(-1px);
}

.btn-hero .arrow {
  color: #fb923c;
  font-size: 16px;
}

/* Stats 5-Card Row */
.stats-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card.navy-dark {
  background: var(--primary-navy);
  color: white;
  border-color: var(--primary-navy);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.stat-badge.navy {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.stat-badge.blue {
  background: var(--blue-badge-bg);
  color: var(--blue-badge-text);
}

.stat-badge.amber {
  background: var(--amber-badge-bg);
  color: var(--amber-badge-text);
}

.stat-badge.green {
  background: var(--green-badge-bg);
  color: var(--green-badge-text);
}

.stat-badge.purple {
  background: var(--purple-badge-bg);
  color: var(--purple-badge-text);
}

.stat-icon {
  font-size: 14px;
  color: var(--text-subtle);
}

.stat-card.navy-dark .stat-icon {
  color: rgba(255, 255, 255, 0.6);
}

.stat-number {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.stat-card.navy-dark .stat-number {
  color: white;
}

/* Filter Tabs & Search Bar Row */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #ffffff;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pill:hover {
  background: #f1f5f9;
  border-color: var(--border-hover);
}

.filter-pill.active {
  background: var(--primary-navy);
  color: #ffffff;
  border-color: var(--primary-navy);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  width: 320px;
}

.search-box input {
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
}

.search-box input::placeholder {
  color: var(--text-subtle);
}

/* Main Data Table */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
}

.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
  vertical-align: middle;
}

.data-table tr:hover {
  background: #f8fafc;
}

/* Category Verdict Badges */
.verdict-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.verdict-tag.pass {
  background: var(--green-badge-bg);
  color: var(--green-badge-text);
  border: 1px solid var(--green-badge-border);
}

.verdict-tag.fail {
  background: var(--red-badge-bg);
  color: var(--red-badge-text);
  border: 1px solid var(--red-badge-border);
}

.verdict-tag.reference {
  background: var(--blue-badge-bg);
  color: var(--blue-badge-text);
  border: 1px solid var(--blue-badge-border);
}

/* Table Text Blocks */
.sender-col strong {
  display: block;
  font-size: 13.5px;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 2px;
}

.sender-col span {
  font-size: 11.5px;
  color: var(--text-subtle);
  font-family: monospace;
}

.subject-col strong {
  display: block;
  font-size: 13.5px;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 3px;
}

.subject-col span {
  font-size: 12px;
  color: var(--text-muted);
}

.date-col {
  color: var(--text-muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.date-col span {
  display: block;
  color: var(--text-subtle);
  font-size: 11px;
}

/* Actions in Table */
.action-icons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 15px;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s;
}

.icon-btn:hover {
  color: var(--primary-navy);
  background: #e2e8f0;
}

.icon-btn.delete:hover {
  color: #e11d48;
  background: #ffe4e6;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

/* Modal Popup Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 28px;
  position: relative;
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.modal-content.modal-wide {
  max-width: 900px;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-navy);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

/* Dropzone in Modal */
.modal-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.modal-dropzone:hover, .modal-dropzone.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

.dropzone-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 8px;
}

.dropzone-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.file-selected-pill {
  margin-top: 10px;
  display: inline-block;
  background: #eff6ff;
  color: #2563eb;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-field input, .form-field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  outline: none;
  background: white;
}

.form-field input:focus, .form-field select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-val {
  font-weight: 700;
  color: #2563eb;
  min-width: 44px;
}

/* Spinner */
.spinner {
  border: 3px solid rgba(15, 23, 42, 0.1);
  border-top: 3px solid #0f172a;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Diagnostic Details in Modal */
.diagnostic-banner {
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.diagnostic-banner.pass {
  background: #ecfdf5;
  border: 1.5px solid #a7f3d0;
  color: #065f46;
}

.diagnostic-banner.fail {
  background: #fff1f2;
  border: 1.5px solid #fecdd3;
  color: #9f1239;
}

.diagnostic-img-wrap {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 14px;
}

.diagnostic-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
}
