/* ============================================================
   HRAgent – Global Stylesheet
   Production-grade fintech admin dashboard
   ============================================================ */

/* ── Google Fonts are loaded in base.html ── */

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
  /* Colour palette */
  --clr-bg:           #F0F2F5;
  --clr-surface:      #FFFFFF;
  --clr-surface-2:    #F8F9FB;
  --clr-border:       #E2E6EA;
  --clr-border-light: #EEF0F3;

  --clr-primary:      #2563EB;
  --clr-primary-dk:   #1D4ED8;
  --clr-primary-lt:   #EFF6FF;
  --clr-accent:       #7C3AED;
  --clr-accent-lt:    #F5F3FF;

  --clr-success:      #16A34A;
  --clr-success-lt:   #F0FDF4;
  --clr-warning:      #D97706;
  --clr-warning-lt:   #FFFBEB;
  --clr-danger:       #DC2626;
  --clr-danger-lt:    #FEF2F2;
  --clr-info:         #0284C7;
  --clr-info-lt:      #F0F9FF;

  --clr-text:         #111827;
  --clr-text-2:       #374151;
  --clr-muted:        #6B7280;
  --clr-muted-light:  #9CA3AF;
  --clr-inverse:      #FFFFFF;

  /* Sidebar */
  --sidebar-width:    240px;
  --sidebar-bg:       #1E293B;
  --sidebar-text:     #CBD5E1;
  --sidebar-active:   #2563EB;
  --sidebar-hover:    rgba(255,255,255,0.06);

  /* Topbar */
  --topbar-height:    68px;
  --topbar-bg:        #FFFFFF;
  --topbar-border:    #E2E6EA;

  /* Typography */
  --font-ui:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:        'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* Border radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.08);

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-base:   0.2s ease;
  --transition-slow:   0.3s ease;
  --transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Input/button sizing */
  --input-height:     44px;
  --btn-height:       42px;
  --btn-height-sm:    34px;
  --btn-height-lg:    50px;
}

/* ── Bootstrap Variable Overrides ─────────────────────────── */
:root {
  --bs-primary:         var(--clr-primary);
  --bs-primary-rgb:     37, 99, 235;
  --bs-font-sans-serif: var(--font-ui);
  --bs-border-radius:   var(--radius-sm);
  --bs-border-radius-lg: var(--radius-md);
  --bs-border-color:    var(--clr-border);
  --bs-body-bg:         var(--clr-bg);
  --bs-body-color:      var(--clr-text);
}

/* ── Base Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--clr-bg);
  color: var(--clr-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── Page Transition ──────────────────────────────────────── */
.page-transition {
  animation: pageIn 0.3s ease both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── Layout Shell ─────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: transform var(--transition-base);
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.02em;
}

.sidebar-brand-text span {
  color: var(--clr-primary);
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) 0;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: var(--space-md) var(--space-lg) var(--space-xs);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px var(--space-lg);
  color: var(--sidebar-text);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition-fast);
  position: relative;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #FFFFFF;
}

.sidebar-link.active {
  color: #FFFFFF;
  background: rgba(37,99,235,0.15);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--clr-primary);
  border-radius: 0 2px 2px 0;
}

.sidebar-link .nav-icon {
  width: 20px;
  height: 20px;
  opacity: 0.75;
  flex-shrink: 0;
  font-size: 1.05rem;
}

.sidebar-link.active .nav-icon,
.sidebar-link:hover .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: var(--space-md);
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── Main Content Area ────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: calc(100vw - var(--sidebar-width));
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-xl);
  gap: var(--space-md);
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-xs);
}

.topbar-brand {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--clr-text-2);
}

.topbar-spacer { flex: 1; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--clr-border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.topbar-icon-btn:hover {
  background: var(--clr-surface-2);
  color: var(--clr-text);
  border-color: var(--clr-border);
}

.notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--clr-danger);
  border-radius: 50%;
  border: 1.5px solid var(--topbar-bg);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--clr-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--clr-border);
  transition: border-color var(--transition-fast);
  flex-shrink: 0;
}

.avatar:hover { border-color: var(--clr-primary); }

/* ── Page Body ────────────────────────────────────────────── */
.page-body {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
  padding: var(--space-xl) var(--space-2xl);
}

.page-header {
  margin-bottom: var(--space-xl);
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--clr-text);
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.9375rem;
  color: var(--clr-muted);
  margin: 6px 0 0;
  line-height: 1.5;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 18px var(--space-lg);
  border-bottom: 1px solid var(--clr-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--clr-text);
  margin: 0;
  letter-spacing: -0.01em;
}

.card-body { padding: var(--space-lg); }

/* ── Metric Cards ─────────────────────────────────────────── */
.card-metric {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

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

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  font-size: 1.375rem;
}

.metric-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--clr-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 2.125rem;
  font-weight: 700;
  color: var(--clr-text);
  letter-spacing: -0.03em;
  line-height: 1;
}

.metric-delta {
  font-size: 0.8125rem;
  font-weight: 500;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.metric-delta.up   { color: var(--clr-success); }
.metric-delta.down { color: var(--clr-danger);  }

/* ── Status Badges ────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-queued    { background: #F1F5F9; color: #475569; }
.status-running   { background: #EFF6FF; color: #2563EB; animation: pulse-badge 1.5s infinite; }
.status-completed { background: var(--clr-success-lt); color: var(--clr-success); }
.status-failed    { background: var(--clr-danger-lt);  color: var(--clr-danger);  }
.status-active    { background: var(--clr-success-lt); color: var(--clr-success); }
.status-inactive  { background: #F1F5F9; color: #475569; }
.status-suspended { background: var(--clr-warning-lt); color: var(--clr-warning); }

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 0.9375rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1.125rem;
  min-height: var(--btn-height);
  line-height: 1.4;
}

.btn-sm {
  font-size: 0.8125rem;
  padding: 0.3rem 0.875rem;
  min-height: var(--btn-height-sm);
  gap: 4px;
}

.btn-lg {
  font-size: 1rem;
  padding: 0.75rem 1.625rem;
  min-height: var(--btn-height-lg);
  gap: 8px;
  border-radius: var(--radius-lg);
}

.btn-primary {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--clr-primary-dk);
  border-color: var(--clr-primary-dk);
  color: #fff;
}

.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.85;
}
.btn-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  margin-left: 6px;
}
.btn-outline-loading::after {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--clr-primary);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Forms ────────────────────────────────────────────────── */
.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--clr-text-2);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.form-control, .form-select {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  background: var(--clr-surface);
  color: var(--clr-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  padding: 10px 14px;
  min-height: var(--input-height);
}

.form-control:focus, .form-select:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  outline: none;
  background: var(--clr-surface);
}

.form-control.is-invalid {
  border-color: var(--clr-danger);
  box-shadow: 0 0 0 3px rgba(220,38,38,0.10);
}

.invalid-feedback {
  font-size: 0.8125rem;
  color: var(--clr-danger);
  margin-top: 4px;
}

/* ── Tables ───────────────────────────────────────────────── */
.table-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table {
  margin-bottom: 0;
  font-size: 0.9375rem;
}

.table thead th {
  background: var(--clr-surface-2);
  color: var(--clr-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--clr-border);
  padding: 13px 16px;
  white-space: nowrap;
}

.table tbody td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--clr-border-light);
  vertical-align: middle;
  color: var(--clr-text-2);
  font-size: 0.9375rem;
}

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

.table-hoverable tbody tr {
  transition: background var(--transition-fast);
  cursor: pointer;
}

.table-hoverable tbody tr:hover { background: var(--clr-surface-2); }

/* ── Skeleton Loaders ─────────────────────────────────────── */
@keyframes skeleton-pulse {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    #E9ECF0 25%,
    #F3F5F7 50%,
    #E9ECF0 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.4s ease infinite;
  border-radius: var(--radius-sm);
  display: block;
}

.skeleton-text  { height: 14px; margin-bottom: 8px; }
.skeleton-text:last-child { width: 70%; }
.skeleton-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}
.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
}
.skeleton-btn {
  height: 36px;
  width: 100px;
  border-radius: var(--radius-md);
}
.skeleton-row td > .skeleton { height: 16px; border-radius: 4px; }

/* ── Output Panel (agent streaming) ──────────────────────── */
.output-panel {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: #0F172A;
  color: #E2E8F0;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  min-height: 300px;
  max-height: 600px;
  overflow-y: auto;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid #1E293B;
}

.output-panel::-webkit-scrollbar { width: 6px; }
.output-panel::-webkit-scrollbar-track { background: transparent; }
.output-panel::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

/* Light variant — used when structured/formatted output replaces raw streaming */
.output-panel.output-formatted {
  background: #ffffff;
  color: #1e293b;
  font-family: inherit;
  white-space: normal;
  padding: 0;
  border: none;
}
.output-panel.output-formatted::-webkit-scrollbar-thumb { background: #cbd5e1; }

.cursor-blink {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--clr-primary);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Step Indicator (multi-step forms) ────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: var(--space-xl);
}

.step-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}

.step-item:last-child { flex: none; }

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--clr-border);
  background: var(--clr-surface);
  color: var(--clr-muted);
  font-size: 0.875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.step-circle.active {
  border-color: var(--clr-primary);
  background: var(--clr-primary);
  color: #fff;
}

.step-circle.completed {
  border-color: var(--clr-success);
  background: var(--clr-success);
  color: #fff;
}

.step-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--clr-muted);
}

.step-label.active { color: var(--clr-primary); font-weight: 600; }
.step-label.completed { color: var(--clr-success); }

.step-line {
  flex: 1;
  height: 1.5px;
  background: var(--clr-border);
  margin: 0 var(--space-xs);
  transition: background var(--transition-base);
}

.step-line.completed { background: var(--clr-success); }

/* ── Agent Cards ──────────────────────────────────────────── */
.agent-card {
  background: var(--clr-surface);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  display: block;
  height: 100%;
}

.agent-card:hover {
  border-color: var(--clr-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.agent-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--clr-primary-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
  transition: background var(--transition-fast);
}

.agent-card:hover .agent-card-icon {
  background: var(--clr-primary);
  color: #fff;
}

.agent-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--clr-text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.agent-card-desc {
  font-size: 0.875rem;
  color: var(--clr-muted);
  line-height: 1.55;
}

/* ── Modal Workflow ───────────────────────────────────────── */
.modal-content {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

.modal-header {
  border-bottom: 1px solid var(--clr-border-light);
  padding: var(--space-lg) var(--space-xl);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--clr-text);
  letter-spacing: -0.01em;
}

.modal-footer {
  border-top: 1px solid var(--clr-border-light);
  padding: var(--space-md) var(--space-xl);
}

/* ── Auth Pages ───────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(145deg, #EFF6FF 0%, #F0F2F5 50%, #F5F3FF 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.auth-logo-text {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--clr-text);
  letter-spacing: -0.03em;
}

.auth-logo-text span { color: var(--clr-primary); }

.auth-title {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--clr-text);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 0.9375rem;
  color: var(--clr-muted);
  text-align: center;
  margin-bottom: var(--space-xl);
  line-height: 1.5;
}

/* ── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.875rem;
  background: none;
  padding: 0;
  margin-bottom: var(--space-md);
}

.breadcrumb-item { color: var(--clr-muted); }
.breadcrumb-item.active { color: var(--clr-text-2); font-weight: 500; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--clr-muted-light); }

/* ── Dividers ─────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--clr-border);
  margin: var(--space-lg) 0;
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.3;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-text-2);
  margin-bottom: 6px;
}

.empty-state-text {
  font-size: 0.875rem;
  color: var(--clr-muted);
  margin-bottom: var(--space-lg);
}

/* ── Toggle Switch ────────────────────────────────────────── */
.form-switch .form-check-input {
  width: 2.5em;
  height: 1.3em;
  cursor: pointer;
}

.form-switch .form-check-input:checked {
  background-color: var(--clr-primary);
  border-color: var(--clr-primary);
}

/* ── Dropdown ─────────────────────────────────────────────── */
.dropdown-menu {
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-xs);
  font-size: 0.9375rem;
  min-width: 190px;
}

.dropdown-item {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--clr-text-2);
  transition: background var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.dropdown-item:hover {
  background: var(--clr-primary-lt);
  color: var(--clr-primary);
}

.dropdown-item.text-danger:hover {
  background: var(--clr-danger-lt);
  color: var(--clr-danger);
}

.dropdown-divider { border-color: var(--clr-border-light); margin: 4px 0; }

/* ── Plan Badges ──────────────────────────────────────────── */
.plan-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.plan-starter    { background: #F1F5F9; color: #475569; }
.plan-pro        { background: #EFF6FF; color: #2563EB; }
.plan-enterprise { background: #F5F3FF; color: #7C3AED; }

/* ── Notification Bell ────────────────────────────────────── */
.notif-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--clr-danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--topbar-bg);
}

/* ── Admin Super Badge ────────────────────────────────────── */
.super-admin-badge {
  background: linear-gradient(135deg, #7C3AED, #4F46E5);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* ── SweetAlert2 Overrides ────────────────────────────────── */
.swal2-popup {
  font-family: var(--font-ui) !important;
  border-radius: var(--radius-xl) !important;
  box-shadow: var(--shadow-xl) !important;
}

.swal2-title {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  color: var(--clr-text) !important;
}

.swal2-html-container {
  font-size: 0.9375rem !important;
  color: var(--clr-muted) !important;
}

.swal2-confirm {
  background: var(--clr-primary) !important;
  border-radius: var(--radius-md) !important;
  font-family: var(--font-ui) !important;
  font-weight: 500 !important;
  font-size: 0.9375rem !important;
  padding: 11px 26px !important;
}

.swal2-cancel {
  border-radius: var(--radius-md) !important;
  font-family: var(--font-ui) !important;
  font-weight: 500 !important;
  font-size: 0.9375rem !important;
  padding: 11px 26px !important;
  background: var(--clr-surface-2) !important;
  color: var(--clr-text-2) !important;
  border: 1px solid var(--clr-border) !important;
}

.swal2-cancel:hover {
  background: var(--clr-border) !important;
}

/* ── Scrollbar (global) ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #CBD5E1; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }
  .sidebar-overlay.active { display: block; }

  /* Reduce topbar padding on tablets/mobile */
  .topbar { padding: 0 var(--space-md); }

  /* Page header: stack title and actions vertically */
  .page-header.d-flex { flex-direction: column; align-items: flex-start !important; gap: var(--space-md); }
  .page-header.d-flex > *:last-child { width: 100%; }

  /* Toolbar/filter rows: allow wrapping and full width */
  .toolbar-row,
  .filter-row { flex-wrap: wrap; }
  .toolbar-row .input-group,
  .toolbar-row input[type="text"],
  .toolbar-row select,
  .filter-row .input-group,
  .filter-row input[type="text"],
  .filter-row select { width: 100% !important; max-width: 100% !important; }
}

@media (max-width: 767.98px) {
  /* Tighter page padding on phones */
  .page-body { padding: var(--space-md) var(--space-lg); }

  /* Settings tabs: allow horizontal scroll instead of wrapping */
  .nav-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav-tabs .nav-link { white-space: nowrap; }

  /* Table toolbar filter rows inside cards */
  .table-card .d-flex.align-items-center.justify-content-between { flex-direction: column; align-items: stretch !important; }
  .table-card .d-flex.align-items-center.justify-content-between > span { margin-bottom: var(--space-sm); }
  .table-card .d-flex.gap-2 { flex-wrap: wrap; }
  .table-card .d-flex.gap-2 .input-group,
  .table-card .d-flex.gap-2 input,
  .table-card .d-flex.gap-2 select { width: 100% !important; max-width: 100% !important; }

  /* Page header action buttons full width */
  .page-header .d-flex.gap-2 { flex-wrap: wrap; width: 100%; }
  .page-header .d-flex.gap-2 input,
  .page-header .d-flex.gap-2 select { flex: 1 1 auto; width: auto !important; min-width: 0; }

  /* Reduce font size on base to reclaim space */
  html { font-size: 15px; }

  /* Cards: reduce inner padding */
  .card-body { padding: var(--space-md) !important; }

  /* Stat cards: tighten up */
  .stat-value { font-size: 1.5rem !important; }
}

@media (max-width: 575.98px) {
  .auth-card { padding: var(--space-xl) var(--space-md); }

  /* Interview session page: compact controls */
  .iv-controls { padding: 0 var(--space-sm); }

  /* Stack page header search inputs fully */
  .page-header .d-flex { flex-direction: column; }
  .page-header .d-flex input,
  .page-header .d-flex select { width: 100% !important; }
}

/* ── Nav Tabs ─────────────────────────────────────────────── */
.nav-tabs .nav-link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--clr-muted);
  padding: 10px 18px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-tabs .nav-link:hover {
  color: var(--clr-text-2);
  background: var(--clr-surface-2);
}

.nav-tabs .nav-link.active {
  font-weight: 600;
  color: var(--clr-primary);
}

/* ── Form text (helper text below inputs) ─────────────────── */
.form-text {
  font-size: 0.8125rem;
  margin-top: 5px;
}

/* ── Topbar icon button larger ────────────────────────────── */
.topbar-icon-btn {
  width: 38px;
  height: 38px;
}

/* ── Card body comfortable padding ───────────────────────── */
.card-body {
  padding: 24px;
}

/* ── Page body more breathing room ───────────────────────── */
.page-body {
  padding: 40px 56px;
}

/* ── Table inside card: header text larger ────────────────── */
.table-card .table thead th {
  font-size: 0.75rem;
}

/* ── Topbar tenant selector readable ─────────────────────── */
.topbar-brand {
  font-size: 0.9375rem;
  font-weight: 600;
}

/* ── Plan badge slightly bigger ───────────────────────────── */
.plan-badge {
  font-size: 0.7rem;
  padding: 3px 10px;
}

/* ── Result Document Viewer Modal ────────────────────────────────────────────── */
.result-modal-dialog {
  margin: 3vh auto;
}
.result-modal-content {
  height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Section nav pill bar */
.result-section-nav {
  flex-shrink: 0;
  background: #f8fafc;
  border-bottom: 1px solid var(--clr-border-light);
  overflow-x: auto;
  padding: 0 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.result-section-nav::-webkit-scrollbar { display: none; }
.result-section-nav-inner {
  display: flex;
  gap: 2px;
  padding: 7px 0;
  min-width: max-content;
}
.result-section-pill {
  padding: 3px 14px;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.6;
  transition: background .12s, color .12s, border-color .12s;
}
.result-section-pill:hover {
  background: #e2e8f0;
  color: #1e293b;
}
.result-section-pill.active {
  background: var(--clr-primary);
  color: #fff;
  border-color: var(--clr-primary);
}

/* Scrollable body */
.result-modal-body {
  flex: 1 1 0;
  overflow: hidden;
  position: relative;
}

/* Div-based renderer (resume screening) */
.result-output {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* iframe document viewer */
.result-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #f0f2f5;
}

/* Mobile: full-screen */
@media (max-width: 575.98px) {
  .result-modal-dialog {
    margin: 0;
    max-width: 100%;
  }
  .result-modal-content {
    height: 100dvh;
    border-radius: 0;
  }
}
