:root {
  /* Light Theme Variables (Clean, Modern, Apple-inspired) */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --accent-primary: #2563eb;
  --accent-secondary: #3b82f6;
  --border-color: #e2e8f0;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --input-focus-ring: rgba(37, 99, 235, 0.2);
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(226, 232, 240, 0.8);
  --radius: 12px;
  --radius-sm: 8px;
}

[data-theme='dark'] {
  /* Dark Theme Variables (Premium Vercel/Linear-inspired) */
  --bg-primary: #09090b;
  --bg-secondary: #121214;
  --bg-tertiary: #18181b;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --accent-primary: #3b82f6;
  --accent-secondary: #60a5fa;
  --border-color: #27272a;
  --input-bg: #09090b;
  --input-border: #27272a;
  --input-focus-ring: rgba(59, 130, 246, 0.25);
  
  --success: #10b981;
  --warning: #fbbf24;
  --danger: #ef4444;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.6);
  
  --glass-bg: rgba(18, 18, 20, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* =========================================================================
   Base & Reset
   ========================================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden; /* Fix horizontal body scrolling */
  max-width: 100vw;
}

/* Typography */
h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 1rem; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; letter-spacing: -0.01em; color: var(--text-primary); }
h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-secondary); }
p { color: var(--text-secondary); font-size: 0.875rem; }
small { font-size: 0.75rem; color: var(--text-secondary); }

/* =========================================================================
   Utility Classes
   ========================================================================= */
.text-center { text-align: center; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.pb-6 { padding-bottom: 1.5rem; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; margin: 0 auto; }
.hidden { display: none !important; }

/* Grid Utilities */
.gap-6 { gap: 1.5rem; }

@media (min-width: 768px) {
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:col-span-3 { grid-column: span 3 / span 3; }
  .md\:col-span-4 { grid-column: span 4 / span 4; }
}


/* Responsive Grid System (Mobile First) */
.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr; /* Stacks everything by default on mobile */
  width: 100%; /* Ensure grid doesn't overflow parent */
}

/* Tablet & Up */
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid { gap: 1.5rem; }
  
  .md\:flex-row { flex-direction: row; }
  .md\:items-center { align-items: center; }
  .md\:w-auto { width: auto; }
}

/* =========================================================================
   Layout & Components
   ========================================================================= */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem; /* Slightly smaller padding on mobile to save space */
}

@media (min-width: 640px) {
  .container { padding: 0 1.5rem; }
}

.main-content {
  flex: 1;
  padding: 1.5rem 0 3rem 0;
  width: 100%;
}

/* Premium Card */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  width: 100%; /* Prevent horizontal overflow */
  overflow-x: hidden;
  overflow-y: visible; /* avoid clipping native pickers / focus rings on mobile */
}

@media (min-width: 640px) {
  .card { padding: 2rem; box-shadow: var(--shadow-lg); }
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  width: 100%;
}

label {
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

input, select, textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--input-border);
  background-color: var(--input-bg);
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

/*
 * Native <select> with appearance:none breaks iOS Safari: the options UI can anchor
 * to the wrong place (e.g. over unrelated buttons). Keep the custom arrow only on
 * precise pointers (mouse / most desktops); on phones and touch tablets use UA styling.
 */
@media (hover: hover) and (pointer: fine) {
  select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
    padding-right: 2.5rem;
  }
}

@media (hover: none), (pointer: coarse) {
  select,
  select.form-control {
    appearance: revert;
    -webkit-appearance: revert;
    background-image: none;
    padding-right: 0.875rem;
  }
}

input::placeholder, textarea::placeholder {
  color: #71717a; /* Muted aesthetic for placeholders */
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

input:disabled {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.7;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--input-bg);
  background-clip: padding-box;
  border: 1px solid var(--input-border);
  appearance: none;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  border-color: var(--accent-primary);
  outline: 0;
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}


/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: max-content;
  user-select: none;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
  background-color: var(--accent-secondary);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-tertiary);
}

/* Navbar */
.navbar {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100vw;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  background-clip: text;
  line-height: 1.2;
}

@media (min-width: 640px) {
  .logo { font-size: 1.25rem; }
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  scrollbar-width: none; /* Hide scrollbar Firefox */
}
.tabs::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome/Safari */

.tab-btn {
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-primary);
}

/* Table Design (Scrollable wrapper for Mobile) */
.table-container,
.table-wrapper {
  margin-top: 1rem;
  width: 100%;
  overflow-x: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch; 
}


table {
  width: 100%;
  min-width: 1200px; /* Increased to accommodate 13 columns cleanly */
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}

th {
  background-color: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: var(--bg-tertiary);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); border-color: rgba(16, 185, 129, 0.2); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); border-color: rgba(245, 158, 11, 0.2); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }

/* Theme Toggle Button */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
  background-color: var(--border-color);
  transform: scale(1.05);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  left: 1.5rem; /* Allow stretching on mobile */
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none; /* Let clicks pass through if toast overlaps */
}

@media (min-width: 640px) {
  #toast-container {
    left: auto;
    max-width: 380px;
  }
}

.toast {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  animation: slideInBottom 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 500;
  pointer-events: auto; /* Enable clicks on the toast itself */
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

@keyframes slideInBottom {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Report Cards — see enhanced styles in ENHANCED REPORTS DASHBOARD section below */

/* Filter Bar Specific adjustments to prevent overlap */
.filter-bar {
  background: var(--bg-tertiary);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

/* Modal System */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-backdrop.active .modal {
  transform: translateY(0);
}

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

/* Animations */
/* Opacity-only: transform on ancestors can confuse mobile select / picker layering */
@keyframes slideIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

/* =========================================================================
   RTL (Right-to-Left) Support
   ========================================================================= */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .text-center { text-align: center; }

[dir="rtl"] .ml-auto { margin-right: auto; margin-left: 0; }
[dir="rtl"] .mr-auto { margin-left: auto; margin-right: 0; }

@media (hover: hover) and (pointer: fine) {
  [dir="rtl"] select {
    background-position: left 0.75rem center;
    padding-right: 0.875rem;
    padding-left: 2.5rem;
  }
}

[dir="rtl"] table {
  text-align: right;
}

[dir="rtl"] th {
  text-align: right;
}

[dir="rtl"] #toast-container {
  right: auto;
  left: 1.5rem;
}

@media (min-width: 640px) {
  [dir="rtl"] #toast-container {
    right: 1.5rem;
    left: auto;
  }
}

[dir="rtl"] .toast {
  border-left: 1px solid var(--border-color);
  border-right: 4px solid var(--accent-primary);
}

[dir="rtl"] .toast.success { border-right-color: var(--success); }
[dir="rtl"] .toast.error { border-right-color: var(--danger); }



/* Fix for icons that should point left in RTL */
[dir="rtl"] .icon-rtl-flip {
  transform: scaleX(-1);
}

/* Adjustments for specific components */
[dir="rtl"] .filter-bar .form-group {
  text-align: right;
}

[dir="rtl"] .report-card {
  text-align: right;
}

[dir="rtl"] .tab-btn {
  border-bottom: 2px solid transparent;
}

[dir="rtl"] .tab-btn.active {
  border-bottom-color: var(--accent-primary);
}

/* =========================================================================
   ENHANCED REPORTS DASHBOARD STYLES
   ========================================================================= */

/* Reports header + filter toolbar */
.reports-hero {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 0.5rem;
}

.reports-hero-text {
  flex: 1;
  min-width: 0;
}

.reports-title {
  margin: 0 0 0.25rem 0;
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.reports-subtitle {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.reports-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  min-width: 0;
}

.reports-toolbar-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .reports-toolbar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .reports-field--campaign {
    grid-column: 1 / -1;
  }
}

@media (min-width: 768px) {
  .reports-hero {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem 1.5rem;
    margin-bottom: 0.75rem;
  }
  .reports-toolbar {
    flex: 1 1 26rem;
    max-width: 100%;
    min-width: min(100%, 26rem);
  }
  .reports-toolbar-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(10rem, 1.35fr);
    align-items: end;
  }
  .reports-field--campaign {
    grid-column: auto;
  }
}

.reports-field-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.35rem;
}

.reports-field .form-control,
.reports-field select.form-control {
  width: 100%;
  min-height: 2.5rem;
}

.reports-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.reports-toolbar-actions .btn {
  flex: 1 1 auto;
  justify-content: center;
  min-height: 2.5rem;
}

@media (min-width: 480px) {
  .reports-toolbar-actions .btn:not(.reports-btn-print) {
    flex: 0 1 auto;
    min-width: 6.5rem;
  }
  .reports-toolbar-actions {
    justify-content: flex-end;
  }
}

.reports-btn-print {
  flex: 0 0 auto !important;
  min-width: 2.75rem !important;
  padding: 0.625rem 0.875rem !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.reports-roi-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0 0 1.25rem 0;
  max-width: 52rem;
}

.reports-campaign-roi-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .reports-campaign-roi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .reports-campaign-roi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .reports-campaign-roi-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.reports-roi-footnote {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0.5rem 0 0 0;
}

.report-card--compact {
  padding: 1rem 1.1rem;
}

.rep-card-header--compact {
  margin-bottom: 0.35rem;
}

.rep-card-header--compact h3 {
  font-size: 0.6875rem;
  line-height: 1.35;
}

.report-value--compact {
  font-size: clamp(1.1rem, 3vw, 1.35rem);
}

.reports-kpi-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .reports-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .reports-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Colored KPI Cards */
.report-card {
  position: relative;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.report-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.report-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.report-card-blue::before  { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.report-card-green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.report-card-teal::before  { background: linear-gradient(90deg, #0ea5e9, #38bdf8); }
.report-card-orange::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.report-card-emerald::before { background: linear-gradient(90deg, #059669, #10b981); }
.report-card-red::before   { background: linear-gradient(90deg, #ef4444, #f87171); }

.rep-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.rep-card-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.rep-card-header h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.35;
  word-break: break-word;
}

.report-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.rep-card-sub {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  line-height: 1.45;
}

/* Rate Pills Row */
.rep-rates-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .rep-rates-row {
    display: flex;
    flex-wrap: wrap;
  }
}

.rep-rate-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  flex: 1;
  min-width: 0;
  min-height: 4.25rem;
  justify-content: center;
  text-align: center;
  transition: transform 0.2s ease;
}

@media (min-width: 640px) {
  .rep-rate-pill {
    min-width: 7.5rem;
    padding: 0.75rem 1.15rem;
  }
}

@media (min-width: 960px) {
  .rep-rate-pill {
    min-width: 8.5rem;
  }
}

.rep-rate-pill:hover { transform: translateY(-1px); }

.rep-rate-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
  line-height: 1.3;
  text-wrap: balance;
}

.rep-rate-value {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.15rem;
}

.rep-rate-blue   { background: rgba(59,130,246,0.1);  color:#3b82f6; border-color: rgba(59,130,246,0.2); }
.rep-rate-green  { background: rgba(16,185,129,0.1);  color:#10b981; border-color: rgba(16,185,129,0.2); }
.rep-rate-red    { background: rgba(239,68,68,0.1);   color:#ef4444; border-color: rgba(239,68,68,0.2);  }
.rep-rate-orange { background: rgba(245,158,11,0.1);  color:#f59e0b; border-color: rgba(245,158,11,0.2); }

/* Chart Cards */
.report-chart-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

.report-chart-card:hover {
  box-shadow: var(--shadow-md);
}

.rep-chart-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.rep-chart-container {
  position: relative;
  width: 100%;
  max-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rep-chart-container canvas {
  max-height: 240px;
}

/* Staff Leaderboard */
.rep-leaderboard {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
}

.rep-leaderboard-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: background 0.15s ease;
}

.rep-leaderboard-item:hover {
  background: var(--bg-primary);
}

.rep-leaderboard-rank {
  font-size: 0.9rem;
  font-weight: 700;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.rep-leaderboard-info {
  flex: 1;
  min-width: 0;
}

.rep-leaderboard-name {
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rep-leaderboard-meta {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.1rem;
}

.rep-leaderboard-count {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.rep-leaderboard-bar-wrap {
  width: 60px;
  height: 6px;
  background: var(--border-color);
  border-radius: 9999px;
  overflow: hidden;
  flex-shrink: 0;
}

.rep-leaderboard-bar {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  transition: width 0.5s ease;
}

/* RTL report adjustments */
[dir="rtl"] .rep-card-header { flex-direction: row-reverse; }
[dir="rtl"] .rep-leaderboard-item { flex-direction: row-reverse; }
[dir="rtl"] .rep-leaderboard-bar { background: linear-gradient(270deg, #3b82f6, #60a5fa); }

/* Print styles */
@media print {
  .navbar, .tabs, #btn-generate-report, button, .btn { display: none !important; }
  .report-chart-card, .report-card { break-inside: avoid; }
  body { background: white !important; }
}


/* =========================================================================
   MODERATOR FORM — Sectioned Layout
   ========================================================================= */
.mod-form-section {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  transition: border-color 0.2s ease;
}

.mod-form-section:last-of-type {
  margin-bottom: 0;
}

.mod-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.mod-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
  margin: 0;
}

/* RTL support */
[dir="rtl"] .mod-section-header { flex-direction: row-reverse; }

