/* ==========================================================================
   AIME CRM — Components
   Cards, Tables, Badges, Modals, Toasts, Forms, Buttons, Kanban
   ========================================================================== */

/* --------------------------------------------------------------------------
   BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 8px 16px;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-body);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-base);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

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

/* Primary */
.btn-primary {
  background: var(--aime-teal);
  color: #ffffff;
  border-color: var(--aime-teal);
}
.btn-primary:hover {
  background: var(--aime-teal-dark);
  border-color: var(--aime-teal-dark);
  box-shadow: var(--shadow-teal);
}
.btn-primary:active { transform: scale(0.98); }

/* Secondary */
.btn-secondary {
  background: var(--surface-raised);
  color: var(--text-primary);
  border-color: var(--surface-border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--surface-overlay);
  border-color: var(--surface-border-strong);
}
.btn-secondary:active { transform: scale(0.98); }

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

/* Danger */
.btn-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger-border);
}
.btn-danger:hover {
  background: var(--color-danger);
  color: white;
}

/* Gold / Premium action */
.btn-gold {
  background: var(--aime-gold);
  color: #ffffff;
  border-color: var(--aime-gold);
}
.btn-gold:hover {
  background: var(--aime-gold-dark);
  border-color: var(--aime-gold-dark);
}

/* Sizes */
.btn-xs { padding: 4px 10px; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-sm { padding: 6px 12px; font-size: var(--text-sm); }
.btn-lg { padding: 11px 24px; font-size: var(--text-md); border-radius: var(--radius-lg); }

/* Icon-only */
.btn-icon {
  padding: 8px;
  width: 32px;
  height: 32px;
}
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 6px; }
.btn-icon.btn-lg { width: 40px; height: 40px; padding: 10px; }

/* Loading state */
.btn.is-loading { pointer-events: none; }
.btn.is-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: var(--space-2);
}

/* --------------------------------------------------------------------------
   BADGES / TAGS
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: var(--color-success-border);
}
.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: var(--color-warning-border);
}
.badge-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger-border);
}
.badge-info {
  background: var(--color-info-bg);
  color: var(--color-info);
  border-color: var(--color-info-border);
}
.badge-neutral {
  background: var(--color-neutral-bg);
  color: var(--color-neutral);
  border-color: var(--color-neutral-border);
}
.badge-teal {
  background: var(--aime-teal-light);
  color: var(--text-teal);
  border-color: rgba(0, 168, 150, 0.25);
}
.badge-gold {
  background: var(--aime-gold-light);
  color: var(--text-gold);
  border-color: rgba(200, 136, 26, 0.25);
}

/* Stage badges */
.badge-stage {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Dot indicator inside badge */
.badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

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

.card-padded {
  padding: var(--space-5);
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.card-header-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

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

.card-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--surface-border);
  background: var(--surface-overlay);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Hoverable card */
.card-hover {
  cursor: pointer;
  transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--surface-border-strong);
}

/* KPI / Stat card */
.kpi-card {
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--kpi-accent, var(--aime-teal));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kpi-card .kpi-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

.kpi-card .kpi-value {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
}

.kpi-card .kpi-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-xs);
  font-weight: 600;
  margin-top: var(--space-2);
}

.kpi-card .kpi-change.up   { color: var(--color-success); }
.kpi-card .kpi-change.down { color: var(--color-danger); }
.kpi-card .kpi-change.flat { color: var(--text-tertiary); }

.kpi-card .kpi-icon {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--kpi-icon-bg, var(--aime-teal-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--kpi-icon-color, var(--text-teal));
  font-size: 16px;
}

/* --------------------------------------------------------------------------
   TABLES
   -------------------------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.table thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
  background: var(--surface-overlay);
  border-bottom: 1px solid var(--surface-border);
  white-space: nowrap;
  user-select: none;
}

.table thead th.sortable {
  cursor: pointer;
  transition: color var(--transition-fast);
}
.table thead th.sortable:hover { color: var(--text-primary); }
.table thead th.sort-asc::after  { content: ' ↑'; color: var(--text-teal); }
.table thead th.sort-desc::after { content: ' ↓'; color: var(--text-teal); }

.table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--surface-border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition-fast);
}
.table tbody tr:hover td {
  background: var(--surface-overlay);
}

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

/* Table row link */
.table tbody tr.clickable {
  cursor: pointer;
}

/* Sticky first column */
.table .col-sticky {
  position: sticky;
  left: 0;
  background: var(--surface-raised);
  z-index: 1;
}
.table tbody tr:hover .col-sticky {
  background: var(--surface-overlay);
}

/* Table cell types */
.table .cell-primary {
  font-weight: 600;
  color: var(--text-primary);
}

.table .cell-mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.table .cell-actions {
  text-align: right;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.table tbody tr:hover .cell-actions { opacity: 1; }

/* Compact table variant */
.table-compact thead th { padding: 8px 10px; }
.table-compact tbody td { padding: 8px 10px; }

/* --------------------------------------------------------------------------
   AVATAR
   -------------------------------------------------------------------------- */
.avatar {
  border-radius: var(--radius-full);
  background: var(--surface-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
}

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

.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Color variants for initials avatars */
.avatar-teal    { background: var(--aime-teal-light); color: var(--text-teal); }
.avatar-gold    { background: var(--aime-gold-light); color: var(--text-gold); }
.avatar-purple  { background: #f3f0f8; color: #6b5b95; }
.avatar-blue    { background: #e8f0fc; color: #2660a4; }
.avatar-orange  { background: #fef0e8; color: #b85c1a; }

/* Avatar stack */
.avatar-stack {
  display: flex;
}
.avatar-stack .avatar {
  border: 2px solid var(--surface-raised);
  margin-left: -8px;
}
.avatar-stack .avatar:first-child { margin-left: 0; }

/* --------------------------------------------------------------------------
   FORMS
   -------------------------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.form-label-required::after {
  content: ' *';
  color: var(--color-danger);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: var(--leading-relaxed);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  font-weight: 500;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  line-height: var(--leading-snug);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder { color: var(--text-placeholder); }
.select { cursor: pointer; }
.textarea { resize: vertical; min-height: 80px; }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--aime-teal);
  box-shadow: var(--shadow-focus);
}

.input.is-error,
.select.is-error,
.textarea.is-error {
  border-color: var(--color-danger);
}

.input.is-error:focus,
.select.is-error:focus,
.textarea.is-error:focus {
  box-shadow: 0 0 0 3px rgba(184, 50, 50, 0.15);
}

/* Input with prefix/suffix icon */
.input-wrapper {
  position: relative;
}
.input-wrapper .input {
  padding-left: 36px;
}
.input-wrapper .input-icon-left {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  display: flex;
  align-items: center;
}
.input-wrapper .input-action-right {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

/* Search input */
.search-input {
  padding-left: 36px;
}

/* Checkbox & Radio */
.checkbox-group,
.radio-group {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.checkbox-group input[type="checkbox"],
.radio-group input[type="radio"] {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  accent-color: var(--aime-teal);
  cursor: pointer;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   MODAL
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 23, 20, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn 150ms ease;
}

.modal-backdrop.is-hidden { display: none; }

.modal {
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  animation: scaleIn 180ms ease;
  overflow: hidden;
}

.modal-sm  { max-width: 420px; }
.modal-lg  { max-width: 720px; }
.modal-xl  { max-width: 960px; }

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
  font-size: 18px;
}
.modal-close:hover {
  background: var(--surface-overlay);
  color: var(--text-primary);
}

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

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  background: var(--surface-overlay);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   DRAWER (Slide-out panel)
   -------------------------------------------------------------------------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 23, 20, 0.35);
  z-index: 800;
  animation: fadeIn 150ms ease;
}
.drawer-backdrop.is-hidden { display: none; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: var(--surface-raised);
  border-left: 1px solid var(--surface-border);
  box-shadow: var(--shadow-xl);
  z-index: 801;
  display: flex;
  flex-direction: column;
  animation: slideInRight 240ms ease;
}

.drawer.is-hidden {
  display: none;
}

.drawer-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-shrink: 0;
}

.drawer-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.drawer-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
  font-size: 18px;
}
.drawer-close:hover {
  background: var(--surface-overlay);
  color: var(--text-primary);
}

.drawer-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

/* --------------------------------------------------------------------------
   TOAST NOTIFICATIONS
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  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);
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 400px;
  pointer-events: all;
  animation: fadeInUp 240ms ease;
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

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

.toast-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.toast-message {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: var(--leading-relaxed);
}

.toast-dismiss {
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.toast-dismiss:hover { color: var(--text-primary); }

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

/* --------------------------------------------------------------------------
   TABS
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--surface-border);
  gap: 0;
}

.tab-item {
  padding: 10px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition-base), border-color var(--transition-base);
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

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

.tab-item.active {
  color: var(--text-teal);
  border-bottom-color: var(--aime-teal);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   KANBAN BOARD
   -------------------------------------------------------------------------- */
.kanban-board {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  overflow-x: auto;
  min-height: calc(100vh - var(--topbar-height) - 80px);
  align-items: flex-start;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.kanban-column {
  flex-shrink: 0;
  width: 270px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none;
}

.kanban-column-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.kanban-stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kanban-column-count {
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  background: var(--surface-overlay);
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.kanban-column-body {
  background: var(--surface-overlay);
  border: 1px solid var(--surface-border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 120px;
}

/* Kanban card (opportunity) */
.kanban-card {
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  cursor: pointer;
  transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
  box-shadow: var(--shadow-xs);
  position: relative;
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--surface-border-strong);
}

.kanban-card.sortable-ghost {
  opacity: 0.4;
  background: var(--aime-teal-light);
  border-color: var(--aime-teal);
}

.kanban-card.sortable-drag {
  box-shadow: var(--shadow-xl);
  opacity: 0.95;
  transform: rotate(1.5deg);
}

.kanban-card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: var(--leading-snug);
  margin-bottom: var(--space-1);
}

.kanban-card-company {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-3);
}

.kanban-card-value {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-teal);
}

.kanban-card-date {
  font-size: var(--text-xs);
  color: var(--text-placeholder);
}

/* Kanban totals bar at bottom of column header */
.kanban-column-total {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-teal);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   ACTIVITY FEED
   -------------------------------------------------------------------------- */
.activity-feed {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  position: relative;
}

.activity-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 40px;
  bottom: 0;
  width: 1px;
  background: var(--surface-border);
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 2px solid var(--surface-raised);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  background: var(--surface-overlay);
  color: var(--text-tertiary);
  position: relative;
  z-index: 1;
}

.activity-icon.type-call    { background: var(--color-info-bg); color: var(--color-info); }
.activity-icon.type-email   { background: var(--aime-teal-light); color: var(--text-teal); }
.activity-icon.type-meeting { background: var(--aime-gold-light); color: var(--text-gold); }
.activity-icon.type-note    { background: var(--color-neutral-bg); color: var(--color-neutral); }
.activity-icon.type-stage   { background: var(--color-success-bg); color: var(--color-success); }
.activity-icon.type-ai      { background: var(--stage-prospecting-bg); color: var(--stage-prospecting); }

.activity-content {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}

.activity-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-snug);
}

.activity-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.activity-time {
  font-size: var(--text-xs);
  color: var(--text-placeholder);
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   AI PANEL / INSIGHTS
   -------------------------------------------------------------------------- */
.ai-panel {
  background: linear-gradient(135deg, #faf9f7 0%, #f5f3ef 100%);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.ai-panel-header {
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(135deg, rgba(0,212,184,0.06) 0%, rgba(245,166,35,0.04) 100%);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ai-panel-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--aime-teal), var(--aime-teal-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: var(--shadow-teal);
}

.ai-panel-title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
}

.ai-panel-subtitle {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.ai-panel-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.ai-insight-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ai-insight-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
}

.ai-insight-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.ai-risk-bar {
  height: 6px;
  background: var(--surface-inset);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.ai-risk-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

.ai-risk-fill.low     { background: var(--color-success); }
.ai-risk-fill.medium  { background: var(--color-warning); }
.ai-risk-fill.high    { background: var(--color-danger); }

/* --------------------------------------------------------------------------
   EMPTY STATE
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-20) var(--space-6);
  text-align: center;
  gap: var(--space-4);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: var(--surface-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-placeholder);
}

.empty-state-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.empty-state-message {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 320px;
  line-height: var(--leading-relaxed);
}

/* --------------------------------------------------------------------------
   SKELETON LOADER
   -------------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-overlay) 25%,
    var(--surface-inset) 50%,
    var(--surface-overlay) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
}

.skeleton-text:last-child { width: 60%; }

/* --------------------------------------------------------------------------
   PROGRESS BAR
   -------------------------------------------------------------------------- */
.progress {
  height: 6px;
  background: var(--surface-inset);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
  background: var(--aime-teal);
}

.progress-bar.warning { background: var(--aime-gold); }
.progress-bar.danger  { background: var(--color-danger); }
.progress-bar.success { background: var(--color-success); }

/* --------------------------------------------------------------------------
   DIVIDER
   -------------------------------------------------------------------------- */
.divider {
  height: 1px;
  background: var(--surface-border);
  border: none;
  margin: 0;
}

/* --------------------------------------------------------------------------
   DROPDOWN MENU
   -------------------------------------------------------------------------- */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 500;
  padding: var(--space-1) 0;
  animation: fadeInDown 150ms ease;
}

.dropdown-menu.is-hidden { display: none; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 14px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

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

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

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

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

/* --------------------------------------------------------------------------
   TOOLTIP
   -------------------------------------------------------------------------- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--text-inverse);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 1000;
}

[data-tooltip]:hover::after { opacity: 1; }

/* --------------------------------------------------------------------------
   SEARCH BAR (global)
   -------------------------------------------------------------------------- */
.global-search {
  position: relative;
  width: 280px;
}

.global-search input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  background: var(--surface-overlay);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  transition: all var(--transition-base);
  font-family: inherit;
}

.global-search input::placeholder { color: var(--text-placeholder); }

.global-search input:focus {
  background: var(--surface-raised);
  border-color: var(--aime-teal);
  box-shadow: var(--shadow-focus);
  outline: none;
  width: 340px;
}

.global-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   BREADCRUMB
   -------------------------------------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

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

.breadcrumb-item a {
  color: var(--text-tertiary);
  transition: color var(--transition-fast);
}
.breadcrumb-item a:hover { color: var(--text-primary); }

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 500;
}

.breadcrumb-sep {
  color: var(--text-placeholder);
}

/* --------------------------------------------------------------------------
   DATA HIGHLIGHT / STAT INLINE
   -------------------------------------------------------------------------- */
.stat-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-overlay);
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   PROBABILITY INDICATOR
   -------------------------------------------------------------------------- */
.prob-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.prob-pips {
  display: flex;
  gap: 2px;
}

.prob-pip {
  width: 6px;
  height: 12px;
  border-radius: 1px;
  background: var(--surface-inset);
}

.prob-pip.filled { background: var(--aime-teal); }
.prob-pip.filled.warn { background: var(--aime-gold); }
.prob-pip.filled.low  { background: var(--color-danger); }
