/* ─────────────────────────────────────────────────────────────────────────────
   PathwAI — Component Library
   Buttons, cards, modals, forms, badges, alerts, progress, toasts, tabs, etc.
   ───────────────────────────────────────────────────────────────────────────── */

/* ══════════════════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.5625rem var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border: 1.5px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    border-color     var(--transition-fast),
    color            var(--transition-fast),
    box-shadow       var(--transition-fast),
    transform        var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }

/* Primary */
.btn-primary {
  background: var(--color-primary-600);
  color: var(--color-white);
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover {
  background: var(--color-primary-700);
  box-shadow: 0 4px 20px 0 rgb(79 70 229 / 0.4);
}

/* Secondary */
.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--color-slate-400);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* Brand ghost */
.btn-ghost-brand {
  background: transparent;
  color: var(--color-primary-600);
  border-color: transparent;
}
.btn-ghost-brand:hover {
  background: var(--color-primary-50);
}

/* Danger */
.btn-danger {
  background: var(--color-red-600);
  color: var(--color-white);
}
.btn-danger:hover { background: var(--color-red-700); }

/* Danger outline */
.btn-danger-outline {
  background: transparent;
  color: var(--color-red-600);
  border-color: var(--color-red-200);
}
.btn-danger-outline:hover {
  background: var(--color-red-50);
  border-color: var(--color-red-300);
}

/* Success */
.btn-success {
  background: var(--color-emerald-600);
  color: var(--color-white);
}
.btn-success:hover { background: var(--color-emerald-700); }

/* Sizes */
.btn-xs {
  padding: 0.3125rem var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}
.btn-sm {
  padding: 0.4375rem var(--space-4);
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
}
.btn-lg {
  padding: 0.8125rem var(--space-8);
  font-size: var(--text-md);
  border-radius: var(--radius-xl);
}
.btn-xl {
  padding: 1rem var(--space-10);
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

/* Icon-only */
.btn-icon {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.btn-icon.btn-sm { padding: 0.3125rem; }
.btn-icon.btn-lg { padding: var(--space-3); }

/* Loading state */
.btn.is-loading {
  color: transparent;
  pointer-events: none;
}
.btn.is-loading::after {
  content: '';
  position: absolute;
  top: calc(50% - 7px);
  left: calc(50% - 7px);
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
  color: var(--color-white);
}
.btn-secondary.is-loading::after,
.btn-ghost.is-loading::after { color: var(--color-primary-600); }

/* Credit cost label inside button */
.btn-credit-cost {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  background: rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  margin-left: var(--space-1);
}
.btn-secondary .btn-credit-cost,
.btn-ghost .btn-credit-cost {
  background: var(--color-primary-50);
  color: var(--color-primary-700);
}

/* ══════════════════════════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.card-compact { padding: var(--space-4); }
.card-flat { border: none; box-shadow: var(--shadow-sm); }
.card-brand {
  background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-800));
  color: var(--color-white);
  border: none;
}
.card-brand .card-title,
.card-brand .card-label { color: rgba(255,255,255,0.85); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
}
.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}
.card-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}
.card-footer {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* Stat card */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  line-height: 1;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}
.stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
}
.stat-delta {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.stat-delta.positive { color: var(--color-emerald-600); }
.stat-delta.negative { color: var(--color-red-600); }

/* ══════════════════════════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}
.modal-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - var(--space-8));
  overflow-y: auto;
  transform: scale(0.96) translateY(8px);
  transition: transform var(--transition-base), opacity var(--transition-base);
  opacity: 0;
  position: relative;
}
.modal-overlay.is-open .modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.modal-sm { max-width: 380px; }
.modal-lg { max-width: 680px; }
.modal-xl { max-width: 900px; }

/* Flat variant used by payments.js and page-level modals — no enter animation,
   visibility is controlled entirely by the parent overlay's opacity/display. */
.modal-box {
  background: var(--bg-surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - var(--space-8));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-6) 0;
}
.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
}
.modal-close {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.modal-close:hover { background: var(--border-default); color: var(--text-primary); }

.modal-body {
  padding: var(--space-5) var(--space-6);
}
.modal-footer {
  padding: 0 var(--space-6) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Auth modal tabs */
.auth-tabs {
  display: flex;
  background: var(--bg-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-1);
  margin-bottom: var(--space-5);
  gap: var(--space-1);
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  border: none;
  background: transparent;
}
.auth-tab.is-active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ══════════════════════════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1-5);
}
.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  text-align: left;
}
.form-label .required {
  color: var(--color-red-500);
  margin-left: 2px;
}
.form-hint {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}
.form-error {
  font-size: var(--text-xs);
  color: var(--color-red-600);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid #d1d5db;
  border-radius: var(--radius-lg);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  outline: none;
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}
.form-input.has-error,
.form-select.has-error,
.form-textarea.has-error {
  border-color: var(--color-red-400);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: var(--leading-relaxed);
}

/* Input with icon */
.form-input-wrap {
  position: relative;
}
.form-input-wrap .form-input {
  padding-left: 2.5rem;
}
.form-input-wrap .input-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 16px; height: 16px;
}
.form-input-wrap .input-suffix {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}
.form-check-input {
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-surface);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.form-check-input[type="radio"] { border-radius: var(--radius-full); }
.form-check-input:checked {
  background: var(--color-primary-600);
  border-color: var(--color-primary-600);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 8'%3E%3Cpath fill='%23fff' d='M1 4l3 3 5-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 60%;
}
.form-check-input[type="radio"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Ccircle fill='%23fff' cx='4' cy='4' r='2.5'/%3E%3C/svg%3E");
  background-size: 70%;
}
.form-check-label {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: var(--leading-normal);
}
.form-check-label small { color: var(--text-secondary); }

/* Toggle / Switch */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}
.toggle-switch {
  position: relative;
  width: 36px; height: 20px;
  flex-shrink: 0;
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-slate-300);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--color-white);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base);
}
.toggle-switch input:checked ~ .toggle-track {
  background: var(--color-primary-600);
}
.toggle-switch input:checked ~ .toggle-thumb {
  transform: translateX(16px);
}
.toggle-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}

/* Divider with text */
.form-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin: var(--space-5) 0;
}
.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border-default);
}

/* ══════════════════════════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-full);
  line-height: 1.6;
  white-space: nowrap;
}
.badge-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
  flex-shrink: 0;
}

/* Color variants */
.badge-gray    { background: var(--color-slate-100); color: var(--color-slate-700); }
.badge-blue    { background: var(--color-primary-100); color: var(--color-primary-700); }
.badge-green   { background: var(--color-emerald-100); color: var(--color-emerald-700); }
.badge-yellow  { background: var(--color-amber-100); color: var(--color-amber-700); }
.badge-red     { background: var(--color-red-100); color: var(--color-red-700); }
.badge-purple  { background: #ede9fe; color: #6d28d9; }
.badge-pink    { background: #fce7f3; color: #be185d; }
.badge-orange  { background: #ffedd5; color: #c2410c; }

/* Application status */
.badge-planning   { background: var(--color-slate-100); color: var(--color-slate-600); }
.badge-accepted   { background: var(--color-emerald-100); color: var(--color-emerald-800); }
.badge-submitted  { background: var(--color-sky-100); color: var(--color-sky-700); }
.badge-waitlisted { background: var(--color-amber-100); color: var(--color-amber-800); }
.badge-denied     { background: var(--color-red-100); color: var(--color-red-700); }

/* List category */
.badge-dream   { background: #fde8ff; color: #86198f; }
.badge-reach   { background: var(--color-red-50); color: var(--color-red-600); }
.badge-target  { background: var(--color-amber-50); color: var(--color-amber-700); }
.badge-safety  { background: var(--color-emerald-50); color: var(--color-emerald-700); }

/* ══════════════════════════════════════════════════════════════════════════════
   ALERTS / BANNERS
   ══════════════════════════════════════════════════════════════════════════════ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  border: 1px solid transparent;
}
.alert-icon {
  flex-shrink: 0;
  width: 18px; height: 18px;
  margin-top: 1px;
}
.alert-content { flex: 1; }
.alert-title {
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
}

.alert-info    { background: var(--color-sky-50);     color: var(--color-sky-800);     border-color: var(--color-sky-200); }
.alert-success { background: var(--color-emerald-50); color: var(--color-emerald-800); border-color: var(--color-emerald-200); }
.alert-warning { background: var(--color-amber-50);   color: var(--color-amber-800);   border-color: var(--color-amber-200); }
.alert-danger  { background: var(--color-red-50);     color: var(--color-red-800);     border-color: var(--color-red-200); }

/* ══════════════════════════════════════════════════════════════════════════════
   PROGRESS BARS
   ══════════════════════════════════════════════════════════════════════════════ */
.progress {
  width: 100%;
  height: 8px;
  background: var(--color-slate-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-sm { height: 5px; }
.progress-lg { height: 12px; }

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary-600);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.success { background: var(--color-emerald-500); }
.progress-fill.warning { background: var(--color-amber-500); }
.progress-fill.danger  { background: var(--color-red-500); }
.progress-fill.gradient {
  background: linear-gradient(90deg, var(--color-primary-500), var(--color-primary-400));
}

/* Labeled progress */
.progress-labeled {
  display: flex;
  flex-direction: column;
  gap: var(--space-1-5);
}
.progress-labeled-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
}
.progress-labeled-header .label { font-weight: var(--weight-medium); }
.progress-labeled-header .value { color: var(--text-secondary); }

/* ══════════════════════════════════════════════════════════════════════════════
   SPINNER / LOADER
   ══════════════════════════════════════════════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid var(--color-slate-200);
  border-top-color: var(--color-primary-600);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
.spinner-xl { width: 48px; height: 48px; border-width: 4px; }
.spinner-white {
  border-color: rgba(255,255,255,0.3);
  border-top-color: var(--color-white);
}

/* Full-page loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-surface);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}
.loading-overlay .loading-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  border-bottom: 1.5px solid var(--border-default);
  gap: 0;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast);
  text-decoration: none;
  background: transparent;
  border-top: none; border-left: none; border-right: none;
}
.tab:hover {
  color: var(--text-primary);
  border-bottom-color: var(--color-slate-300);
}
.tab.is-active {
  color: var(--color-primary-600);
  border-bottom-color: var(--color-primary-600);
  font-weight: var(--weight-semibold);
}
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}
.tab.is-active .tab-count {
  background: var(--color-primary-100);
  color: var(--color-primary-700);
}

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* Pills tabs variant */
.tabs-pills {
  display: flex;
  gap: var(--space-1);
  border-bottom: none;
  flex-wrap: wrap;
}
.tabs-pills .tab {
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-default);
  margin: 0;
  padding: var(--space-1-5) var(--space-4);
  border-bottom: 1.5px solid var(--border-default);
}
.tabs-pills .tab:hover { background: var(--bg-subtle); }
.tabs-pills .tab.is-active {
  background: var(--color-primary-50);
  border-color: var(--color-primary-300);
  color: var(--color-primary-700);
}

/* ══════════════════════════════════════════════════════════════════════════════
   TOASTS / NOTIFICATIONS
   ══════════════════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-slate-900);
  color: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  min-width: 300px;
  max-width: 420px;
  pointer-events: all;
  animation: slideInRight var(--transition-slow) ease;
}
.toast.is-leaving {
  animation: slideOutRight var(--transition-slow) ease forwards;
}
.toast-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
}
.toast-message {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.7);
  margin-top: 2px;
}
.toast-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--color-white); }

.toast-success { background: var(--color-emerald-700); }
.toast-warning { background: var(--color-amber-600); }
.toast-error   { background: var(--color-red-700); }
.toast-info    { background: var(--color-primary-700); }

/* ══════════════════════════════════════════════════════════════════════════════
   DROPDOWN MENUS
   ══════════════════════════════════════════════════════════════════════════════ */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 200px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  padding: var(--space-1-5);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  pointer-events: none;
}
.dropdown-menu.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
.dropdown-menu-left { left: 0; right: auto; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background var(--transition-fast);
  text-decoration: none;
}
.dropdown-item:hover { background: var(--bg-subtle); }
.dropdown-item.danger { color: var(--color-red-600); }
.dropdown-item.danger:hover { background: var(--color-red-50); }
.dropdown-item-icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.dropdown-separator {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-1-5) var(--space-1);
}
.dropdown-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3) var(--space-1);
}

/* ══════════════════════════════════════════════════════════════════════════════
   AVATARS
   ══════════════════════════════════════════════════════════════════════════════ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-weight: var(--weight-semibold);
  flex-shrink: 0;
  overflow: hidden;
  background: var(--color-primary-100);
  color: var(--color-primary-700);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 24px; height: 24px; font-size: var(--text-xs); }
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-sm); }
.avatar-md { width: 40px; height: 40px; font-size: var(--text-base); }
.avatar-lg { width: 56px; height: 56px; font-size: var(--text-xl); }
.avatar-xl { width: 80px; height: 80px; font-size: var(--text-2xl); }

/* ══════════════════════════════════════════════════════════════════════════════
   CREDIT METER
   ══════════════════════════════════════════════════════════════════════════════ */
.credit-meter {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.credit-meter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
}
.credit-balance {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}
.credit-balance .credit-unit {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  margin-left: 2px;
}
.credit-low { color: var(--color-red-600); }
.credit-medium { color: var(--color-amber-600); }
.credit-good { color: var(--color-emerald-600); }

/* Credit confirmation tooltip */
.credit-confirm {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-slate-800);
  color: var(--color-white);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
}
.credit-confirm-cost {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: var(--weight-semibold);
  color: var(--color-amber-400);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════════════
   STEP INDICATOR (onboarding wizard)
   ══════════════════════════════════════════════════════════════════════════════ */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
}
.step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  position: relative;
}
.step:not(:last-child)::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--color-slate-200);
  margin: 0 var(--space-2);
  transition: background var(--transition-slow);
}
.step.is-completed:not(:last-child)::after { background: var(--color-primary-400); }

.step-number {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  flex-shrink: 0;
  background: var(--color-slate-100);
  color: var(--text-muted);
  border: 2px solid var(--border-default);
  transition:
    background var(--transition-base),
    color var(--transition-base),
    border-color var(--transition-base);
}
.step.is-active .step-number {
  background: var(--color-primary-600);
  color: var(--color-white);
  border-color: var(--color-primary-600);
  box-shadow: var(--shadow-brand);
}
.step.is-completed .step-number {
  background: var(--color-primary-600);
  border-color: var(--color-primary-600);
  color: var(--color-white);
}
.step-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  white-space: nowrap;
}
.step.is-active .step-label { color: var(--color-primary-600); font-weight: var(--weight-semibold); }
.step.is-completed .step-label { color: var(--text-secondary); }

/* ══════════════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-12) var(--space-8);
  gap: var(--space-4);
}
.empty-state-icon {
  width: 64px; height: 64px;
  background: var(--bg-subtle);
  border-radius: var(--radius-2xl);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.empty-state-body {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 320px;
  line-height: var(--leading-relaxed);
}

/* ══════════════════════════════════════════════════════════════════════════════
   PROBABILITY BADGE (college match)
   ══════════════════════════════════════════════════════════════════════════════ */
.probability-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}
.probability-high   { background: var(--color-emerald-100); color: var(--color-emerald-800); }
.probability-medium { background: var(--color-amber-100);   color: var(--color-amber-800); }
.probability-low    { background: var(--color-red-100);     color: var(--color-red-700); }

/* ══════════════════════════════════════════════════════════════════════════════
   STRENGTH-O-METER (essay scores)
   ══════════════════════════════════════════════════════════════════════════════ */
.strength-meter {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.strength-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.strength-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-secondary);
  width: 90px;
  flex-shrink: 0;
}
.strength-bar {
  flex: 1;
  height: 6px;
  background: var(--color-slate-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, var(--color-primary-400), var(--color-primary-600));
}
.strength-score {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  width: 24px;
  text-align: right;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   UPGRADE PROMPT (insufficient credits)
   ══════════════════════════════════════════════════════════════════════════════ */
.upgrade-prompt {
  background: linear-gradient(135deg, var(--color-primary-50), var(--color-primary-100));
  border: 1px solid var(--color-primary-200);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-4);
}
.upgrade-prompt-icon {
  width: 48px; height: 48px;
  background: var(--color-primary-600);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-white);
}
.upgrade-prompt-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-primary-900);
}
.upgrade-prompt-body {
  font-size: var(--text-sm);
  color: var(--color-primary-700);
  max-width: 280px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   ADL-MODAL — Gradient modal design system (used across all add/edit modals)
   ══════════════════════════════════════════════════════════════════════════════ */
.adl-modal-box {
  max-width: 460px !important;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(15,23,42,0.2), 0 4px 16px rgba(15,23,42,0.06);
}
.adl-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 22px 18px;
  background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
  position: relative;
}
.adl-header-icon {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  flex-shrink: 0;
}
.adl-header-text { flex: 1; min-width: 0; }
.adl-header-title {
  font-size: 15px;
  font-weight: 700;
  color: white;
  margin: 0 0 2px;
  line-height: 1.2;
}
.adl-header-sub {
  font-size: 11.5px;
  color: rgba(255,255,255,0.65);
  margin: 0;
}
.adl-close {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 7px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 120ms;
}
.adl-close:hover { background: rgba(255,255,255,0.28); color: white; }
.adl-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.adl-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.adl-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.adl-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-slate-500);
}
.adl-req { color: var(--color-red-500); margin-left: 1px; }
.adl-opt {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-slate-400);
  font-size: 10.5px;
}
.adl-input {
  width: 100%;
  height: 37px;
  padding: 0 11px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--color-slate-900);
  background: var(--color-slate-50);
  border: 1.5px solid var(--color-slate-200);
  border-radius: 9px;
  outline: none;
  transition: border-color 140ms, background 140ms, box-shadow 140ms;
  box-sizing: border-box;
}
.adl-input:focus {
  border-color: var(--color-primary-400);
  background: white;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.adl-input::placeholder { color: var(--color-slate-400); }
.adl-textarea {
  height: auto;
  padding: 9px 11px;
  resize: none;
  line-height: 1.5;
}
.adl-select-wrap { position: relative; }
.adl-select {
  width: 100%;
  height: 37px;
  padding: 0 30px 0 11px;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--color-slate-900);
  background: var(--color-slate-50);
  border: 1.5px solid var(--color-slate-200);
  border-radius: 9px;
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: border-color 140ms, background 140ms, box-shadow 140ms;
  box-sizing: border-box;
}
.adl-select:focus {
  border-color: var(--color-primary-400);
  background: white;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.adl-chevron {
  position: absolute;
  right: 9px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--color-slate-400);
}
.adl-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px 20px;
  border-top: 1.5px solid var(--color-slate-100);
}
.adl-btn-cancel {
  height: 36px;
  padding: 0 15px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--color-slate-600);
  background: transparent;
  border: 1.5px solid var(--color-slate-200);
  border-radius: 9px;
  cursor: pointer;
  transition: background 130ms, border-color 130ms, color 130ms;
}
.adl-btn-cancel:hover {
  background: var(--color-slate-50);
  border-color: var(--color-slate-300);
  color: var(--color-slate-900);
}
.adl-btn-save {
  height: 36px;
  padding: 0 17px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  color: white;
  background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
  border: none;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 10px rgba(79,70,229,0.35);
  transition: box-shadow 140ms, transform 140ms, filter 140ms;
}
.adl-btn-save:hover {
  box-shadow: 0 6px 20px rgba(79,70,229,0.45);
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.adl-btn-save:active { transform: translateY(0); }
@media (max-width: 480px) {
  .adl-row { grid-template-columns: 1fr; }
}
