/* ============================================================
   CAMPUSLINK — Component Styles
   Cards, buttons, tables, modals, forms, badges, toasts,
   score rings, charts, and all reusable UI components.
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  overflow: hidden;
  min-height: 40px;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--gradient-accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 12px hsla(var(--accent-hue), 91%, 60%, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px hsla(var(--accent-hue), 91%, 60%, 0.45);
  transform: translateY(-2px);
  border-color: transparent;
}

.btn-success {
  background: var(--success);
  border-color: transparent;
  color: #fff;
}

.btn-danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

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

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: 12px;
  min-height: 32px;
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: 15px;
  min-height: 48px;
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
}

.card:hover {
  border-color: var(--border-default);
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.card-accent {
  border-color: hsla(var(--accent-hue), 91%, 60%, 0.2);
  background: linear-gradient(135deg, var(--bg-elevated) 0%, hsla(var(--accent-hue), 50%, 15%, 0.3) 100%);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ---------- KPI Cards ---------- */
.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: all var(--duration-normal) var(--ease-out);
  animation: fadeInUp var(--duration-slow) var(--ease-out) both;
}

.kpi-card:hover {
  border-color: var(--border-default);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: var(--space-2);
  animation: countUp var(--duration-slow) var(--ease-out) both;
}

.kpi-delta {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.kpi-delta.positive {
  color: var(--success);
}

.kpi-delta.negative {
  color: var(--danger);
}

.kpi-delta.neutral {
  color: var(--text-muted);
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 18px;
  margin-bottom: var(--space-3);
}

.kpi-icon.blue   { background: var(--accent-soft); color: var(--accent); }
.kpi-icon.green  { background: var(--success-soft); color: var(--success); }
.kpi-icon.orange { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.red    { background: var(--danger-soft); color: var(--danger); }

/* ---------- Badges / Tags ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-accent  { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-info    { background: var(--info-soft); color: var(--info); }
.badge-muted   { background: hsla(0,0%,100%,0.06); color: var(--text-muted); }

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: dotPulse 2s ease-in-out infinite;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
}

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

.status-applied     { background: var(--info-soft); color: var(--info); }
.status-shortlisted { background: var(--accent-soft); color: var(--accent); }
.status-interview   { background: var(--warning-soft); color: var(--warning); }
.status-offered     { background: var(--success-soft); color: var(--success); }
.status-accepted    { background: var(--success-soft); color: var(--success); }
.status-rejected    { background: var(--danger-soft); color: var(--danger); }
.status-scheduled   { background: var(--accent-soft); color: var(--accent); }
.status-confirmed   { background: var(--success-soft); color: var(--success); }
.status-draft       { background: hsla(0,0%,100%,0.06); color: var(--text-muted); }

/* ---------- Data Tables ---------- */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.data-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--duration-fast) var(--ease-out);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

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

.table-cell-main {
  font-weight: 600;
}

.table-cell-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------- Score Ring ---------- */
.score-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.score-ring svg {
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 8;
}

.score-ring-progress {
  fill: none;
  stroke: url(#scoreGradient);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s var(--ease-out);
  animation: ringProgress 1.2s var(--ease-out) both;
}

.score-ring-content {
  position: absolute;
  text-align: center;
}

.score-ring-value {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.score-ring-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------- Progress Bars ---------- */
.progress-bar {
  height: 6px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-accent);
  border-radius: var(--radius-full);
  transition: width 0.8s var(--ease-out);
  animation: barGrow 0.8s var(--ease-out) both;
}

.progress-bar-fill.success { background: var(--gradient-success); }
.progress-bar-fill.warning { background: var(--gradient-warm); }

.progress-group {
  margin-bottom: var(--space-4);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: var(--space-2);
}

.progress-label-name {
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-label-value {
  color: var(--text-primary);
  font-weight: 700;
}

/* ---------- Charts ---------- */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  height: 180px;
  padding-top: var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-2);
}

.bar-chart-col {
  flex: 1;
  min-width: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  height: 100%;
  justify-content: flex-end;
}

.bar-chart-bar {
  width: 100%;
  max-width: 48px;
  background: var(--gradient-accent);
  border-radius: var(--radius-sm) var(--radius-sm) 2px 2px;
  transition: height 0.6s var(--ease-out);
  animation: barGrow 0.8s var(--ease-out) both;
  position: relative;
  min-height: 8px;
}

.bar-chart-bar:hover {
  filter: brightness(1.2);
}

.bar-chart-bar.green {
  background: var(--gradient-success);
}

.bar-chart-bar.warm {
  background: var(--gradient-warm);
}

.bar-chart-label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
  max-width: 58px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-chart-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: hsla(228, 30%, 4%, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  animation: fadeIn var(--duration-fast) var(--ease-out);
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-xl);
  animation: scaleIn var(--duration-normal) var(--ease-spring);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
}

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

.modal-body {
  margin-bottom: var(--space-5);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

@media (max-width: 480px) {
  .modal-backdrop {
    padding: var(--space-2);
  }

  .modal-dialog {
    padding: var(--space-4);
    max-height: 94vh;
    border-radius: var(--radius-lg);
  }

  .modal-header {
    margin-bottom: var(--space-3);
  }

  .modal-title {
    font-size: 16px;
  }

  .modal-footer {
    flex-direction: column-reverse;
    gap: var(--space-2);
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: var(--space-5);
}

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

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: all var(--duration-fast) var(--ease-out);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: var(--space-1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.form-check input[type="radio"] {
  border-radius: 50%;
}

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

.form-check input:checked::after {
  content: '✓';
  display: block;
  text-align: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
}

/* ---------- Insight / Alert Cards ---------- */
.insight-card {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.6;
  border-left: 3px solid;
}

.insight-card.accent {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.insight-card.warning {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning);
}

.insight-card.success {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}

.insight-card.danger {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.insight-card strong {
  display: block;
  margin-bottom: var(--space-1);
}

/* ---------- List Items ---------- */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--duration-fast) var(--ease-out);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:hover {
  background: var(--bg-hover);
  margin: 0 calc(-1 * var(--space-4));
  padding-left: var(--space-4);
  padding-right: var(--space-4);
  border-radius: var(--radius-md);
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

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

.list-item-meta {
  display: flex;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: 12px;
  margin-top: var(--space-2);
}

/* ---------- Job Cards ---------- */
.job-card {
  padding: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--duration-fast) var(--ease-out);
}

.job-card:last-child {
  border-bottom: none;
}

.job-card:hover {
  background: var(--bg-hover);
}

.job-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-2);
}

.job-card-title {
  font-weight: 700;
  font-size: 15px;
}

.job-card-company {
  font-size: 13px;
  color: var(--text-muted);
}

.match-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--success-soft);
  color: var(--success);
  white-space: nowrap;
}

.job-card-meta {
  display: flex;
  gap: var(--space-4);
  color: var(--text-muted);
  font-size: 12px;
  margin: var(--space-2) 0 var(--space-3);
}

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  top: 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: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  pointer-events: auto;
  animation: toastIn var(--duration-normal) var(--ease-spring);
}

.toast.exiting {
  animation: toastOut var(--duration-fast) var(--ease-out) forwards;
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 13px;
}

.toast-message {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1);
  font-size: 14px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--info); }

/* ---------- Empty States ---------- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: 13px;
  max-width: 360px;
  margin: 0 auto var(--space-5);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-wrap: nowrap;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--duration-fast) var(--ease-out);
  margin-bottom: -1px;
  flex-shrink: 0;
  white-space: nowrap;
}

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

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ---------- Skill Tags ---------- */
.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease-out);
}

.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.skill-tag.matched {
  background: var(--success-soft);
  border-color: hsla(152, 60%, 48%, 0.3);
  color: var(--success);
}

.skill-tag.missing {
  background: var(--danger-soft);
  border-color: hsla(0, 72%, 60%, 0.3);
  color: var(--danger);
}

.skill-tag.high {
  background: var(--danger-soft);
  border-color: hsla(0, 72%, 60%, 0.3);
  color: var(--danger);
}

.skill-tag.medium {
  background: var(--warning-soft);
  border-color: hsla(38, 92%, 58%, 0.3);
  color: var(--warning);
}

/* ---------- Avatar ---------- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }

.avatar-blue   { background: var(--accent-soft); color: var(--accent); }
.avatar-green  { background: var(--success-soft); color: var(--success); }
.avatar-orange { background: var(--warning-soft); color: var(--warning); }
.avatar-purple { background: hsla(270, 80%, 65%, 0.12); color: hsl(270, 80%, 65%); }

/* ---------- Dividers ---------- */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-5) 0;
}

/* ---------- Utility Classes ---------- */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent  { color: var(--accent); }
.font-bold    { font-weight: 700; }
.font-medium  { font-weight: 500; }
.mt-2         { margin-top: var(--space-2); }
.mt-4         { margin-top: var(--space-4); }
.mt-6         { margin-top: var(--space-6); }
.mb-2         { margin-bottom: var(--space-2); }
.mb-4         { margin-bottom: var(--space-4); }
.mb-6         { margin-bottom: var(--space-6); }
.gap-2        { gap: var(--space-2); }
.gap-3        { gap: var(--space-3); }
.gap-4        { gap: var(--space-4); }
.flex         { display: flex; }
.flex-wrap    { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden       { display: none !important; }

/* ---------- AI Markdown Typography & Typewriter Animation ---------- */
.ai-markdown {
  font-size: 13.5px;
  line-height: 1.68;
  color: var(--text-primary);
  word-break: break-word;
}

.ai-markdown p.ai-p {
  margin: 0 0 10px 0;
  line-height: 1.68;
}

.ai-markdown p.ai-p:last-child {
  margin-bottom: 0;
}

.ai-markdown .ai-heading {
  color: #fff;
  font-weight: 700;
  margin: 14px 0 6px 0;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ai-markdown .ai-heading:first-child {
  margin-top: 2px;
}

.ai-markdown h3.ai-heading {
  font-size: 15px;
  color: var(--accent);
}

.ai-markdown h4.ai-heading {
  font-size: 14px;
  color: #f1f5f9;
}

.ai-markdown strong {
  font-weight: 700;
  color: #ffffff;
}

.ai-markdown em {
  font-style: italic;
  color: var(--text-secondary);
}

.ai-markdown code {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--accent);
}

.ai-markdown ul.ai-list,
.ai-markdown ol.ai-list {
  margin: 6px 0 10px 0;
  padding-left: 20px;
}

.ai-markdown ul.ai-list li,
.ai-markdown ol.ai-list li {
  margin-bottom: 5px;
  line-height: 1.58;
  color: var(--text-secondary);
}

.ai-markdown ul.ai-list li strong,
.ai-markdown ol.ai-list li strong {
  color: var(--text-primary);
}

.ai-note-box {
  background: hsla(217, 91%, 60%, 0.08);
  border: 1px solid hsla(217, 91%, 60%, 0.22);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  margin: 10px 0 8px 0;
  font-size: 12.5px;
  line-height: 1.55;
}

.ai-note-label {
  color: var(--accent);
  font-weight: 700;
  margin-right: 4px;
}

.ai-cursor {
  display: inline-block;
  width: 6px;
  height: 14px;
  background-color: var(--accent);
  margin-left: 2px;
  vertical-align: -1px;
  border-radius: 1px;
  animation: aiCursorBlink 0.7s infinite ease-in-out;
  box-shadow: 0 0 8px hsla(var(--accent-hue), 91%, 60%, 0.6);
}

@keyframes aiCursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.ai-meta-fadein {
  animation: aiMetaFade 0.4s ease-out forwards;
}

@keyframes aiMetaFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

