/* ============================================================
   ApplyApp Dashboard – style.css
   ============================================================ */

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

:root {
  --blue-50:     #EFF6FF;
  --blue-100:    #DBEAFE;
  --blue-200:    #BFDBFE;
  --blue-600:    #2563EB;
  --blue-700:    #1D4ED8;
  --blue-800:    #1E40AF;
  --gray-50:     #F9FAFB;
  --gray-100:    #F3F4F6;
  --gray-200:    #E5E7EB;
  --gray-300:    #D1D5DB;
  --gray-400:    #9CA3AF;
  --gray-500:    #6B7280;
  --gray-700:    #374151;
  --gray-800:    #1F2937;
  --gray-900:    #111827;
  --green-100:   #DCFCE7;
  --green-600:   #16A34A;
  --green-700:   #15803D;
  --yellow-100:  #FEF9C3;
  --yellow-700:  #A16207;
  --red-100:     #FEE2E2;
  --red-600:     #DC2626;
  --blue-100:    #DBEAFE;
  --blue-700:    #1D4ED8;
  --purple-100:  #F3E8FF;
  --purple-700:  #7E22CE;
  --border:      #E2E8F0;

  --sidebar-width: 240px;
  --font: 'Inter', system-ui, sans-serif;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 36px rgba(0,0,0,.12);
}

html { height: 100%; }
body {
  font-family: var(--font);
  color: var(--gray-900);
  background: #F8FAFC;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: .875rem;
  border: 1.5px solid transparent;
  transition: all .15s ease;
  white-space: nowrap;
  cursor: pointer;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn--primary { background: #2563EB; color: #fff; border-color: #2563EB; }
.btn--primary:hover { background: #1D4ED8; border-color: #1D4ED8; }
.btn--primary:focus { box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

.btn--secondary { background: #fff; color: var(--gray-700); border-color: #E2E8F0; }
.btn--secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn--secondary:focus { box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

.btn--ghost { background: none; color: var(--gray-500); border-color: transparent; }
.btn--ghost:hover { background: var(--gray-100); color: var(--gray-700); }

.btn--danger { background: var(--red-600); color: #fff; border-color: var(--red-600); }
.btn--danger:hover { background: #B91C1C; }

.btn--sm { padding: 6px 12px; font-size: .8125rem; }
.btn--lg { padding: 12px 24px; font-size: .9375rem; }
.btn--full { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ── Form elements ───────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--gray-700);
}
.form-label span { color: var(--gray-400); font-weight: 400; margin-left: 4px; }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: .9rem;
  color: var(--gray-900);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--gray-400); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: .8rem; color: var(--gray-400); }
.form-error { font-size: .8rem; color: var(--red-600); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle-switch {
  position: relative;
  width: 40px; height: 22px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  top: 3px; left: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked + .toggle-slider { background: #2563EB; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-label { font-size: .875rem; color: var(--gray-700); font-weight: 500; cursor: pointer; }

/* Color picker */
.color-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
  transition: border-color .15s;
}
.color-field:focus-within { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.color-field input[type="color"] {
  width: 36px; height: 36px;
  border: none;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: none;
}
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-field input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(0,0,0,.12); border-radius: 4px; }
.color-field input[type="text"] {
  border: none;
  outline: none;
  font-size: .875rem;
  font-family: 'Menlo', monospace;
  color: var(--gray-700);
  width: 80px;
  padding: 0;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge--blue   { background: var(--blue-100);   color: var(--blue-700);   }
.badge--green  { background: var(--green-100);  color: var(--green-700);  }
.badge--yellow { background: var(--yellow-100); color: var(--yellow-700); }
.badge--red    { background: var(--red-100);    color: var(--red-600);    }
.badge--purple { background: var(--purple-100); color: var(--purple-700); }
.badge--gray   { background: var(--gray-100);   color: var(--gray-500);   }
.badge--indigo { background: var(--blue-50);    color: var(--blue-700);   }

/* Score pill */
.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: .8125rem;
  font-weight: 700;
  color: #fff;
}
.score-pill--high   { background: #10b981; }
.score-pill--mid    { background: #f97316; }
.score-pill--low    { background: #ef4444; }
.score-pill--none   { background: var(--gray-300); color: var(--gray-500); }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--gray-900);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast--success svg { color: #4ADE80; }
.toast--error   { background: var(--red-600); }
.toast--error svg { color: #FECACA; }

/* ── Auth pages ──────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue-50) 0%, #fff 60%);
  padding: 24px;
}
.auth-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 28px;
}
.auth-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -.02em; }
.auth-subtitle { font-size: .9rem; color: var(--gray-500); margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-divider {
  text-align: center;
  font-size: .8125rem;
  color: var(--gray-400);
  margin: 4px 0;
  position: relative;
}
.auth-footer {
  text-align: center;
  font-size: .875rem;
  color: var(--gray-500);
  margin-top: 20px;
}
.auth-footer a { color: #2563EB; font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }
.auth-error {
  background: var(--red-100);
  color: var(--red-600);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: .875rem;
  display: none;
}
.auth-error.show { display: flex; align-items: center; gap: 8px; }
.auth-success {
  background: var(--green-100);
  color: var(--green-700);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: .875rem;
  display: none;
  gap: 8px;
  align-items: flex-start;
}
.auth-success.show { display: flex; }

/* ── Onboarding wizard ───────────────────────────────────── */
.onboarding-shell {
  min-height: 100vh;
  background: var(--blue-50);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px;
}
.onboarding-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 32px;
}
.wizard-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.wizard-progress {
  padding: 24px 32px 0;
}
.wizard-steps-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 8px;
}
.wizard-step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  flex-shrink: 0;
  transition: all .2s;
  border: 2px solid var(--gray-200);
  color: var(--gray-400);
  background: #fff;
  z-index: 1;
  position: relative;
}
.wizard-step-dot.active { border-color: #2563EB; color: #2563EB; }
.wizard-step-dot.done { background: #2563EB; border-color: #2563EB; color: #fff; }
.wizard-step-line {
  flex: 1;
  height: 2px;
  background: var(--gray-200);
  transition: background .3s;
}
.wizard-step-line.done { background: #2563EB; }
.wizard-step-label {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--gray-400);
  margin-top: 4px;
  padding: 0 2px;
}
.wizard-body { padding: 32px; }
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }
.wizard-panel-title { font-size: 1.25rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -.02em; }
.wizard-panel-sub { font-size: .9rem; color: var(--gray-500); margin-bottom: 24px; }
.wizard-panel-form { display: flex; flex-direction: column; gap: 18px; }
.wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}
.wizard-footer-right { display: flex; gap: 10px; }

/* Question builder */
.question-list { display: flex; flex-direction: column; gap: 12px; }
.question-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 12px;
}
.question-item__body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.question-item__row { display: flex; gap: 8px; align-items: flex-start; }
.question-item__drag {
  cursor: grab;
  color: var(--gray-300);
  padding-top: 4px;
  flex-shrink: 0;
}
.question-item__delete {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color .15s;
  flex-shrink: 0;
}
.question-item__delete:hover { color: var(--red-600); }
.btn-add-question {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1.5px dashed var(--gray-300);
  border-radius: 8px;
  background: none;
  color: var(--gray-500);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: all .15s;
}
.btn-add-question:hover { border-color: #2563EB; color: #2563EB; background: #EFF6FF; }

/* Language checkboxes */
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.lang-checkbox { display: none; }
.lang-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  transition: all .15s;
  user-select: none;
}
.lang-label:hover { border-color: #BFDBFE; background: #EFF6FF; }
.lang-checkbox:checked + .lang-label {
  border-color: #2563EB;
  background: #EFF6FF;
  color: #1D4ED8;
}
.lang-flag { font-size: 1.1rem; }

/* Color preview */
.color-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: var(--gray-50);
  margin-bottom: 20px;
}
.color-preview__swatch {
  width: 44px; height: 44px;
  border-radius: 10px;
  transition: background .2s;
}
.color-preview__text { font-size: .875rem; color: var(--gray-500); }
.color-preview__text strong { color: var(--gray-900); display: block; font-size: .9375rem; }
.color-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── App shell (dashboard layout) ────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar (LIGHT theme) ───────────────────────────────── */
.sidebar {
  width: 240px;
  background: #FFFFFF;
  border-right: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  overflow-y: auto;
}
.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 0;
  font-weight: 700;
  font-size: 1.0625rem;
  color: #111827;
  margin-bottom: 24px;
}
.sidebar__section-label {
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--gray-400);
  padding: 0 16px;
  margin-bottom: 6px;
  margin-top: 16px;
}
.sidebar__nav { padding: 0 8px; flex: 1; }
.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  color: #6B7280;
  transition: all .15s;
  margin-bottom: 2px;
}
.sidebar__nav a svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar__nav a:hover { background: #F3F4F6; color: #111827; }
.sidebar__nav a.active { background: #EFF6FF; color: #2563EB; }
.sidebar__footer {
  padding: 12px;
  border-top: 1px solid #E2E8F0;
}
.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 8px;
}
.sidebar__avatar {
  width: 34px; height: 34px;
  background: #DBEAFE;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  color: #1D4ED8;
  flex-shrink: 0;
}
.sidebar__user-info { flex: 1; overflow: hidden; }
.sidebar__user-name { font-size: .8125rem; font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-email { font-size: .75rem; color: #9CA3AF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__signout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 7px;
  font-size: .8125rem;
  font-weight: 500;
  color: #9CA3AF;
  cursor: pointer;
  transition: all .15s;
}
.sidebar__signout:hover { background: #F3F4F6; color: #374151; }
.sidebar__signout svg { width: 16px; height: 16px; }

/* Main content */
.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.app-header {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  flex-shrink: 0;
}
.app-header__title { font-size: 1rem; font-weight: 700; color: var(--gray-900); flex: 1; }
.app-header__breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .875rem;
  color: var(--gray-500);
  flex: 1;
}
.app-header__breadcrumb a { color: var(--gray-500); }
.app-header__breadcrumb a:hover { color: #2563EB; }
.app-header__breadcrumb .sep { color: var(--gray-300); }
.app-header__breadcrumb .current { color: var(--gray-900); font-weight: 600; }
.app-header__actions { display: flex; align-items: center; gap: 10px; }
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ── Stat cards ──────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card--clickable { cursor: pointer; transition: background .15s, box-shadow .15s, transform .15s; }
.stat-card--clickable:hover { background: #F8FAFC; box-shadow: 0 4px 12px rgba(0,0,0,.08); transform: translateY(-1px); }
.stat-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.stat-card__icon {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.stat-card__icon--blue   { background: rgba(37,99,235,.1);  color: #2563EB; }
.stat-card__icon--green  { background: rgba(16,185,129,.1); color: #10b981; }
.stat-card__icon--orange { background: rgba(249,115,22,.1); color: #f97316; }
.stat-card__icon--purple { background: rgba(139,92,246,.1); color: #8b5cf6; }
.stat-card__icon svg { width: 22px; height: 22px; }
.stat-card__label { color: #6B7280; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; min-height: 2.5em; display: flex; align-items: flex-start; }
.stat-card__value { font-size: 2.25rem; font-weight: 800; color: #111827; letter-spacing: -.03em; line-height: 1.1; }
.stat-card__meta { font-size: .8125rem; color: var(--gray-400); }
.stat-card__meta.up   { color: var(--green-600); }
.stat-card__meta.down { color: var(--red-600); }

/* ── Widget cards ────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.section-sub { font-size: .8125rem; color: var(--gray-500); margin-top: 2px; }
.widget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.widget-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow .2s, border-color .2s;
  cursor: pointer;
}
.widget-card { transition: box-shadow .15s, border-color .15s, transform .15s; }
.widget-card:hover { box-shadow: var(--shadow-md); border-color: var(--gray-300); transform: translateY(-2px); }
.widget-card__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.widget-card__title { font-size: .9375rem; font-weight: 700; color: var(--gray-900); margin-bottom: 2px; }
.widget-card__position { font-size: .8125rem; color: var(--gray-500); }
.widget-card__status {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot--active   { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.15); }
.status-dot--inactive { background: #9CA3AF; }
.widget-card__status-label {
  font-size: .75rem; font-weight: 600;
}
.widget-card__status--active .widget-card__status-label  { color: #059669; }
.widget-card__status--inactive .widget-card__status-label { color: #9CA3AF; }
.widget-card__stats { display: flex; gap: 20px; }
.widget-card__stat { font-size: .8125rem; color: var(--gray-500); }
.widget-card__stat strong { display: block; font-size: 1.125rem; font-weight: 700; color: var(--gray-900); }
.widget-card__footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.widget-card__actions { display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.widget-card:hover .widget-card__actions { opacity: 1; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--gray-400);
}
.empty-state__icon {
  width: 56px; height: 56px;
  background: var(--gray-100);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.empty-state__icon svg { width: 28px; height: 28px; color: var(--gray-400); }
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p { font-size: .875rem; max-width: 280px; margin: 0 auto 20px; }

/* ── Data table ──────────────────────────────────────────── */
.table-wrap {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  flex-wrap: wrap;
}
.search-input-wrap { position: relative; }
.search-input-wrap svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--gray-400);
  pointer-events: none;
}
.search-input {
  padding: 8px 12px 8px 32px;
  border: 1.5px solid var(--gray-200);
  border-radius: 7px;
  font-size: .875rem;
  outline: none;
  width: 240px;
  transition: border-color .15s;
}
.search-input:focus { border-color: #2563EB; }
.filter-select {
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 7px;
  font-size: .875rem;
  outline: none;
  background: #fff;
  color: var(--gray-700);
  cursor: pointer;
}
.filter-select:focus { border-color: #2563EB; }
.table-toolbar__right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td {
  padding: 16px;
  font-size: .875rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .12s; cursor: pointer; }
.data-table tbody tr:hover { background: #EFF6FF; }

.applicant-name-cell { display: flex; align-items: center; gap: 10px; }
.applicant-initials {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #DBEAFE;
  color: #1D4ED8;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
  flex-shrink: 0;
}
.applicant-name { font-weight: 600; color: var(--gray-900); }
.applicant-email { font-size: .8rem; color: var(--gray-400); }

.status-select {
  padding: 4px 8px;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  outline: none;
  background: #fff;
  cursor: pointer;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--gray-100);
  font-size: .8125rem;
  color: var(--gray-500);
}
.pagination__pages { display: flex; gap: 4px; }
.pagination__btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  background: #fff;
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .12s;
}
.pagination__btn:hover { border-color: #2563EB; color: #2563EB; }
.pagination__btn.active { background: #2563EB; border-color: #2563EB; color: #fff; }
.pagination__btn:disabled { opacity: .4; pointer-events: none; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(.98);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: none; }
.modal--wide { max-width: 800px; }
.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.modal__title { font-size: 1.0625rem; font-weight: 800; letter-spacing: -.01em; }
.modal__sub { font-size: .8125rem; color: var(--gray-500); margin-top: 2px; }
.modal__close {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color .12s;
  flex-shrink: 0;
}
.modal__close:hover { color: var(--gray-900); }
.modal__close svg { width: 20px; height: 20px; }
.modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}
.modal__footer {
  padding: 16px 28px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* Chat transcript in modal */
.transcript { display: flex; flex-direction: column; gap: 12px; }
.transcript__msg { display: flex; gap: 10px; }
.transcript__msg--bot { flex-direction: row; }
.transcript__msg--user { flex-direction: row-reverse; }
.transcript__avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .6875rem; font-weight: 700;
}
.transcript__msg--bot .transcript__avatar { background: var(--blue-100); color: var(--blue-700); }
.transcript__msg--user .transcript__avatar { background: var(--gray-200); color: var(--gray-600); }
.transcript__bubble {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: .875rem;
  line-height: 1.55;
  max-width: 80%;
}
.transcript__msg--bot .transcript__bubble {
  background: var(--gray-100);
  color: var(--gray-800);
  border-bottom-left-radius: 4px;
}
.transcript__msg--user .transcript__bubble {
  background: #2563EB;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.transcript__time { font-size: .7rem; color: var(--gray-400); margin-top: 2px; }

/* AI summary block */
.ai-summary-block {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}
.ai-summary-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ai-summary-block__label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #1D4ED8; }
.ai-summary-block p { font-size: .875rem; color: var(--gray-700); line-height: 1.65; }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs { border-bottom: 1px solid var(--gray-200); display: flex; gap: 0; margin-bottom: 24px; }
.tab-btn {
  padding: 11px 18px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-500);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active { color: #2563EB; border-bottom-color: #2563EB; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Widget settings page ────────────────────────────────── */
.settings-section {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.settings-section__title { font-size: .9375rem; font-weight: 700; margin-bottom: 4px; }
.settings-section__sub { font-size: .8125rem; color: var(--gray-500); margin-bottom: 20px; }
.settings-form { display: flex; flex-direction: column; gap: 18px; }

/* Embed code box */
.code-box {
  background: var(--gray-900);
  color: #E2E8F0;
  border-radius: 10px;
  padding: 20px;
  font-family: 'Menlo', 'Courier New', monospace;
  font-size: .8125rem;
  line-height: 1.7;
  position: relative;
  overflow-x: auto;
}
.code-box pre { white-space: pre-wrap; word-break: break-all; }
.code-box__copy {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(255,255,255,.1);
  border: none;
  color: var(--gray-400);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
}
.code-box__copy:hover { background: rgba(255,255,255,.2); color: #fff; }
.code-box .kw  { color: #93C5FD; }
.code-box .str { color: #86EFAC; }
.code-box .attr { color: #FCA5A5; }

/* Apply page URL box */
.apply-url-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #EFF6FF;
  border: 1.5px solid #DBEAFE;
  border-radius: 10px;
}
.apply-url-box__url { flex: 1; font-size: .875rem; color: #2563EB; font-weight: 500; word-break: break-all; }
.apply-url-box__actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .page-body { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Delete row button ───────────────────────────────────────── */
.delete-row-btn {
  background: none;
  border: none;
  color: var(--gray-300);
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
  opacity: 0;
}
tr:hover .delete-row-btn { opacity: 1; }
.delete-row-btn:hover {
  color: var(--red-400);
  background: #FEF2F2;
  opacity: 1;
}

/* ── Sidebar language switcher ───────────────────────────────── */
.sidebar__lang { position: relative; margin-bottom: 8px; }
.sidebar__lang-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  background: #F9FAFB;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  color: #6B7280;
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar__lang-btn:hover { background: #F3F4F6; color: #111827; }
.sidebar__lang-btn svg { flex-shrink: 0; }
.sidebar__lang-btn .chevron { margin-left: auto; transition: transform .2s; }
.sidebar__lang-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.sidebar__lang-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
}
.sidebar__lang-dropdown.open { display: block; }
.sidebar__lang-dropdown button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: .8125rem;
  color: var(--gray-700);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar__lang-dropdown button:hover { background: var(--gray-100); }

/* ── Theme picker ────────────────────────────────────────── */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
@media (max-width: 600px) { .theme-grid { grid-template-columns: repeat(2, 1fr); } }
.theme-card {
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  position: relative;
  text-align: center;
}
.theme-card:hover { border-color: #93C5FD; }
.theme-card--active { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.theme-card__preview {
  border-radius: 6px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 8px;
  gap: 0;
  margin-bottom: 8px;
  border: 1px solid rgba(0,0,0,.08);
  overflow: hidden;
}
.theme-card__name { font-size: .75rem; font-weight: 600; color: var(--gray-700); }
.theme-card__check {
  position: absolute;
  top: 6px; right: 6px;
  width: 18px; height: 18px;
  background: #2563EB;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; font-weight: 700;
}
/* Custom colors collapsible */
.custom-colors-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: .875rem; font-weight: 600; color: var(--gray-700);
  cursor: pointer; user-select: none;
  padding: 10px 0; border-top: 1px solid var(--gray-200);
}
.custom-colors-toggle svg { transition: transform .2s; }
.custom-colors-toggle.open svg { transform: rotate(180deg); }
.custom-colors-body { display: none; margin-top: 16px; }
.custom-colors-body.open { display: block; }

/* ── Collapsible settings sections ────────────────────────── */
.settings-section--collapsible .settings-section__body { display: none; }
.settings-section--collapsible.open .settings-section__body { display: block; }
.settings-section__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.settings-section__header:hover .settings-section__chevron { color: var(--gray-700); }
.settings-section__chevron {
  color: var(--gray-400);
  flex-shrink: 0;
  transition: transform .2s;
  margin-top: 2px;
}
.settings-section--collapsible.open .settings-section__chevron { transform: rotate(180deg); }
.settings-section--collapsible .settings-section__title { margin-bottom: 4px; }
.settings-section--collapsible .settings-section__sub { margin-bottom: 0; }

/* Advanced settings toggle */
.settings-advanced-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--gray-400);
  font-size: .8rem;
  cursor: pointer;
  user-select: none;
  margin-top: 4px;
  padding: 2px 0;
}
.settings-advanced-toggle:hover { color: var(--gray-600); }
.settings-advanced-toggle svg { transition: transform .2s; }
.settings-advanced-toggle.open svg { transform: rotate(180deg); }

/* ── Applicant cards view ────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 16px;
}
.applicant-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.applicant-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.1); transform: translateY(-2px); border-color: #BFDBFE; }

/* Card header */
.acard__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
}
.acard__name-block { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.acard__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: .8125rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.acard__name { font-size: .9rem; font-weight: 700; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acard__contact { font-size: .75rem; color: #9CA3AF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Divider */
.acard__divider { border: none; border-top: 1px solid #F1F5F9; margin: 0; }

/* AI section */
.acard__ai { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.acard__ai-row { display: flex; flex-direction: column; gap: 2px; }
.acard__ai-label { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #9CA3AF; }
.acard__ai-value { font-size: .8125rem; color: #374151; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.acard__rec { display: inline-flex; align-items: center; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; width: fit-content; }
.acard__rec--good  { background: #D1FAE5; color: #065F46; }
.acard__rec--maybe { background: #FEF3C7; color: #92400E; }
.acard__rec--no    { background: #FEE2E2; color: #991B1B; }

/* Footer */
.acard__footer { display: flex; align-items: center; gap: 0; padding: 8px 16px; border-top: 1px solid #F1F5F9; background: #F8FAFC; flex-wrap: wrap; }
.acard__footer-item { font-size: .6875rem; color: #9CA3AF; padding: 0 6px; }
.acard__footer-item:first-child { padding-left: 0; }
.acard__footer-item + .acard__footer-item { border-left: 1px solid #E2E8F0; }
.acard__footer-badge { margin-left: auto; }

/* View toggle buttons */
.view-toggle { display: flex; gap: 4px; }
.view-toggle-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #E2E8F0;
  border-radius: 7px;
  background: #fff;
  color: #9CA3AF;
  cursor: pointer;
  transition: all .15s;
}
.view-toggle-btn:hover { border-color: #2563EB; color: #2563EB; }
.view-toggle-btn.active { background: #EFF6FF; border-color: #2563EB; color: #2563EB; }

/* ══════════════════════════════════════════════════════════════
   MOBILE OPTIMIZATIONS
   ══════════════════════════════════════════════════════════════ */

/* ── Hamburger button (visible on mobile) ───────────────────── */
.sidebar-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: none;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  color: var(--gray-600);
  cursor: pointer;
  transition: background .15s;
}
.sidebar-hamburger:hover { background: var(--gray-100); }
.sidebar-hamburger svg { width: 18px; height: 18px; }

/* ── Sidebar close button (X, only visible on mobile) ───────── */
.sidebar-close {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background .15s, color .15s;
  z-index: 10;
}
.sidebar-close svg { width: 18px; height: 18px; display: block; }
.sidebar-close:hover { background: var(--gray-100); color: var(--gray-700); }

/* ── Sidebar backdrop ───────────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 49;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-backdrop.open { display: block; }

/* ── At 900px the sidebar already slides out ─────────────────
   (existing rule) — we just show the hamburger + close btn    */
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 50; }
  .sidebar-hamburger { display: flex; }
  .sidebar-close { display: flex; }
}

/* ── 768px: full mobile layout ─────────────────────────────── */
@media (max-width: 768px) {

  /* Header */
  .app-header { padding: 0 12px; gap: 8px; }
  .app-header__title { font-size: .9rem; }
  .app-header__breadcrumb {
    font-size: .8rem;
    flex-wrap: wrap;
    gap: 3px;
    line-height: 1.4;
  }
  .app-header__actions { gap: 6px; }

  /* Page body */
  .page-body { padding: 12px 12px 80px; }

  /* Stat cards: 2×2 grid */
  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card { padding: 14px 12px; gap: 4px; }
  .stat-card__icon { width: 34px; height: 34px; margin-bottom: 2px; }
  .stat-card__icon svg { width: 17px; height: 17px; }
  .stat-card__label { font-size: .68rem; min-height: auto; }
  .stat-card__value { font-size: 1.625rem; }
  .stat-card__meta { font-size: .75rem; }

  /* Widget / position cards: 1 column, always show actions */
  .widget-grid { grid-template-columns: 1fr; }
  .widget-card__actions { opacity: 1; }
  .widget-card__footer { flex-wrap: wrap; gap: 8px; }

  /* Apply-URL box: wrap buttons below URL on narrow screens */
  .apply-url-box { flex-wrap: wrap; gap: 8px; }
  .apply-url-box__actions { flex-wrap: wrap; gap: 6px; flex-shrink: 0; }

  /* Tabs: tighter padding, smaller text */
  .tab-btn { padding: 9px 12px; font-size: .8125rem; }

  /* Table toolbar */
  .table-toolbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .search-input-wrap { width: 100%; }
  .search-input { width: 100%; }
  .filter-select { flex: 1; min-width: 120px; }
  .table-toolbar__right { margin-left: 0; flex-wrap: wrap; gap: 6px; }

  /* Applicant cards: 1 column */
  .cards-grid { grid-template-columns: 1fr; padding: 0; gap: 10px; }

  /* Modal: full-width padding */
  .modal-overlay { padding: 8px; }
  .modal { max-height: 95vh; }
  .modal__header { padding: 18px 20px 14px; }
  .modal__body { padding: 18px 20px; }
  .modal__footer { padding: 12px 20px; }

  /* Settings sections */
  .settings-section { padding: 16px; }
  .section-header { flex-wrap: wrap; gap: 8px; }

  /* Color grid in widget settings */
  .color-grid { grid-template-columns: 1fr; gap: 10px; }

  /* Auth cards */
  .auth-card { padding: 24px 18px; }
  .auth-title { font-size: 1.25rem; }

  /* Wizard */
  .wizard-body { padding: 20px; }
  .wizard-footer { padding: 14px 20px; }
}

/* ── 480px: iPhone SE refinements ───────────────────────────── */
@media (max-width: 480px) {
  .stats-row { gap: 8px; }
  .stat-card { padding: 12px 10px; }
  .stat-card__value { font-size: 1.375rem; }
  .stat-card__label { font-size: .65rem; }
  .tab-btn { padding: 8px 10px; font-size: .775rem; }
  .apply-url-box__actions { width: 100%; }
  .apply-url-box__actions .btn { flex: 1; }
  .app-header__breadcrumb .current { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
}
