/*
 * ============================================
 * KHAN AI - REUSABLE COMPONENTS
 * ============================================
 *
 * Design System: Sophistication & Trust + Precision & Density
 * All components follow the 4px grid and use design tokens.
 */

/* ==================== BUTTONS ==================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  line-height: var(--leading-tight);
  text-decoration: none;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary button - Solid accent */
.btn-primary {
  background: var(--color-primary-600);
  color: #ffffff;
  border-color: var(--color-primary-600);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-500);
  border-color: var(--color-primary-500);
}

.btn-primary:active:not(:disabled) {
  background: var(--color-primary-700);
}

/* Secondary button - Outlined */
.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--hover-bg);
  border-color: var(--text-muted);
}

.btn-secondary:active:not(:disabled) {
  background: var(--active-bg);
}

/* Ghost button - Minimal */
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

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

.btn-ghost:active:not(:disabled) {
  background: var(--active-bg);
}

/* Danger button */
.btn-danger {
  background: var(--color-error);
  color: #ffffff;
  border-color: var(--color-error);
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

/* Button sizes */
.btn-sm {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  gap: var(--space-1);
}

.btn-lg {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-md);
}

/* Icon-only button */
.btn-icon {
  padding: var(--space-2);
  min-width: 32px;
  min-height: 32px;
}

.btn-icon.btn-sm {
  padding: var(--space-1);
  min-width: 28px;
  min-height: 28px;
}

/* ==================== CARDS ==================== */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.card-hover {
  transition: all var(--transition-base);
}

.card-hover:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.card-interactive {
  cursor: pointer;
  transition: all var(--transition-base);
}

.card-interactive:hover {
  border-color: var(--color-primary-500);
  background: var(--bg-overlay);
}

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

.card-title {
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
}

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

/* Card body */
.card-body {
  color: var(--text-secondary);
}

/* Card footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-3);
  margin-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

/* ==================== NAVIGATION ==================== */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-default);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--header-height);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  text-decoration: none;
}

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

.khan-inner {
  fill: var(--bg-base);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--hover-bg);
}

.nav-link.active {
  color: var(--color-primary-500);
  background: var(--color-info-muted);
}

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

.nav-notif {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-neutral-400);
  transition: all 0.2s;
}

.nav-notif:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-neutral-100);
}

.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--color-error);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ==================== FOOTER ==================== */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-6);
  background: var(--bg-raised);
  border-top: 1px solid var(--border-default);
  margin-top: auto;
}

.footer-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: var(--space-4);
}

.footer-link {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--color-primary-500);
}

/* ==================== FORMS ==================== */

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

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

.form-label-required::after {
  content: '*';
  margin-left: var(--space-1);
  color: var(--color-error);
}

.form-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  color: var(--text-primary);
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

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

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

.form-input::placeholder {
  color: var(--text-faint);
}

.form-input:disabled {
  background: var(--bg-overlay);
  cursor: not-allowed;
}

/* Textarea */
.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Select */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
}

/* Checkbox & Radio */
.form-checkbox,
.form-radio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.form-checkbox input,
.form-radio input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary-500);
}

/* Form hint/error text */
.form-hint {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.form-error {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-error);
}

.form-input.error {
  border-color: var(--color-error);
}

/* ==================== BADGES ==================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: var(--leading-tight);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.badge-neutral {
  background: var(--bg-overlay);
  color: var(--text-secondary);
}

.badge-primary {
  background: var(--color-info-muted);
  color: var(--color-primary-500);
}

.badge-success {
  background: var(--color-success-muted);
  color: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-muted);
  color: var(--color-warning);
}

.badge-error {
  background: var(--color-error-muted);
  color: var(--color-error);
}

/* Uppercase badges for status */
.badge-status {
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  font-size: 10px;
}

/* Badge with dot indicator */
.badge-dot {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* Alias variants for macro compatibility */
.badge-default { background: var(--bg-overlay); color: var(--text-secondary); }
.badge-info { background: var(--color-info-muted); color: var(--color-primary-500); }
.badge-danger { background: var(--color-error-muted); color: var(--color-error); }

/* Badge sizes */
.badge-sm { font-size: 10px; padding: 1px 6px; }
.badge-lg { font-size: 13px; padding: 4px 10px; }

/* ==================== TAGS ==================== */

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: var(--bg-overlay);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 2px;
  margin-right: -4px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
}

.tag-remove:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

/* ==================== FORM ENHANCEMENTS ==================== */

.form-textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  resize: vertical;
  min-height: 100px;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

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

.form-select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition-base);
}

.form-select:focus {
  outline: none;
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

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

.form-error {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-error);
}

.form-input-error {
  border-color: var(--color-error);
}

.form-input-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* ==================== ALERTS ==================== */

.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.alert-info {
  background: var(--color-info-muted);
  border: 1px solid color-mix(in srgb, var(--color-primary-500) 30%, transparent);
}

.alert-success {
  background: var(--color-success-muted);
  border: 1px solid color-mix(in srgb, var(--color-success) 30%, transparent);
}

.alert-warning {
  background: var(--color-warning-muted);
  border: 1px solid color-mix(in srgb, var(--color-warning) 30%, transparent);
}

.alert-danger {
  background: var(--color-error-muted);
  border: 1px solid color-mix(in srgb, var(--color-error) 30%, transparent);
}

/* ==================== STAT CARDS ==================== */

.stat-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
}

.stat-value {
  display: block;
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  margin-top: var(--space-1);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.stat-card--primary .stat-value { color: var(--color-primary-500); }
.stat-card--success .stat-value { color: var(--color-success); }
.stat-card--warning .stat-value { color: var(--color-warning); }
.stat-card--error .stat-value { color: var(--color-error); }

/* ==================== TABLES ==================== */

.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.table th {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  background: var(--bg-overlay);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.table td {
  color: var(--text-secondary);
}

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

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

/* Monospace table cells for data */
.table-mono td {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* ==================== TABS ==================== */

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border-default);
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  margin-bottom: -1px;
}

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

.tab.active {
  color: var(--color-primary-500);
  border-bottom-color: var(--color-primary-500);
}

.tab-badge {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: var(--font-semibold);
  background: var(--bg-overlay);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.tab.active .tab-badge {
  background: var(--color-info-muted);
  color: var(--color-primary-500);
}

/* Tab panels */
.tab-panel {
  display: none;
  padding: var(--space-4) 0;
}

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

/* ==================== AVATAR ==================== */

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-primary-600);
  color: #ffffff;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  flex-shrink: 0;
}

.avatar-sm { width: 24px; height: 24px; font-size: var(--text-xs); }
.avatar-md { width: 40px; height: 40px; font-size: var(--text-md); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-lg); }
.avatar-xl { width: 64px; height: 64px; font-size: var(--text-xl); }

/* Avatar with image */
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* Avatar group */
.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  margin-left: -8px;
  border: 2px solid var(--bg-base);
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ==================== PROGRESS ==================== */

.progress {
  height: 4px;
  background: var(--bg-overlay);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--color-primary-500);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-bar--success { background: var(--color-success); }
.progress-bar--warning { background: var(--color-warning); }
.progress-bar--error { background: var(--color-error); }

/* Larger progress */
.progress-lg {
  height: 8px;
}

/* ==================== EMPTY STATE ==================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-4);
  background: var(--bg-overlay);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
}

.empty-state-description {
  font-size: var(--text-md);
  color: var(--text-muted);
  max-width: 320px;
  margin: 0 0 var(--space-6);
}

/* Dashed border variant */
.empty-state-bordered {
  background: var(--bg-raised);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

/* ==================== DROPDOWN / MENU ==================== */

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-1);
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  padding: var(--space-1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--transition-fast);
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  color: var(--text-secondary);
  text-decoration: none;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.dropdown-item--danger {
  color: var(--color-error);
}

.dropdown-item--danger:hover {
  background: var(--color-error-muted);
  color: var(--color-error);
}

.dropdown-divider {
  height: 1px;
  margin: var(--space-1) 0;
  background: var(--border-subtle);
}

/* ==================== TOOLTIP ==================== */

.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-md);
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ==================== MODAL ==================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}

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

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}

.modal.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

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

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.modal-body {
  padding: var(--space-4);
  overflow-y: auto;
}

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

/* ==================== KHAN ORB ==================== */

.khan-container {
  position: fixed;
  bottom: 80px;
  right: 40px;
  z-index: var(--z-khan);
}

.khan-orb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-primary-500);
  border: 2px solid var(--color-primary-400);
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.4);
  cursor: pointer;
  transition: all var(--transition-base);
  animation: khan-float 4s ease-in-out infinite;
}

.khan-orb::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-primary-500);
  opacity: 0.4;
  animation: khan-ring-pulse 2s ease-in-out infinite;
}

.khan-orb::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: var(--bg-base);
  border-radius: var(--radius-full);
}

.khan-orb:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 0 32px rgba(6, 182, 212, 0.6);
}

.khan-orb:active {
  transform: scale(0.95);
}

.khan-orb.thinking {
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-700));
}

.khan-orb.thinking::before {
  border-style: dashed;
  animation: khan-spin 1s linear infinite;
}

.khan-label {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: var(--space-1) var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.khan-container:hover .khan-label {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

@keyframes khan-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes khan-ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.1); opacity: 0.2; }
}

@keyframes khan-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==================== THEME TOGGLE ==================== */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--hover-bg);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.theme-icon-sun { display: block; }
.theme-icon-moon { display: none; }

[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: block; }

/* ==================== PAGE LAYOUTS ==================== */

.page {
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: var(--space-6);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.page-header-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0;
}

.page-subtitle {
  font-size: var(--text-md);
  color: var(--text-muted);
  margin: 0;
}

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

/* ==================== KANBAN ==================== */

.kanban-board {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-4);
}

.kanban-column {
  flex: 0 0 280px;
  min-width: 280px;
  max-width: 320px;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.kanban-column-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.kanban-column-title h3 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
  flex: 1;
}

.kanban-column-count {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  padding: 2px 6px;
  background: var(--bg-overlay);
  border-radius: var(--radius-sm);
}

.kanban-column-cards {
  flex: 1;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  overflow-y: auto;
  min-height: 200px;
}

.kanban-column-cards.drag-over {
  background: var(--color-info-muted);
  border-radius: var(--radius-md);
}

.kanban-card {
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  cursor: grab;
  transition: all var(--transition-fast);
}

.kanban-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.kanban-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.kanban-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  color: var(--text-faint);
  font-size: var(--text-sm);
}

/* ==================== STATUS DOTS ==================== */

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.status-dot--new { background: var(--color-slate-400); }
.status-dot--contacted { background: #3b82f6; }
.status-dot--discovery { background: #8b5cf6; }
.status-dot--proposal { background: var(--color-warning); }
.status-dot--negotiation { background: #ec4899; }
.status-dot--won { background: var(--color-success); }
.status-dot--lost { background: var(--color-error); }
.status-dot--nurture { background: var(--color-primary-500); }

.status-dot--planning { background: var(--color-primary-500); }
.status-dot--executing { background: var(--color-success); }
.status-dot--monitoring { background: var(--color-warning); }
.status-dot--closed { background: var(--color-slate-500); }

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-actions {
    justify-content: flex-end;
  }
}
