/* ============================================================
   AgroRise — Components
   Buttons, cards, forms, badges, tables, modals, toasts, etc.
   ============================================================ */

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-btn);
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast) var(--ease-out),
              box-shadow var(--transition-fast) ease,
              background var(--transition-fast) ease,
              border-color var(--transition-fast) ease,
              color var(--transition-fast) ease;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--gradient-brand);
  color: var(--primary-contrast);
  box-shadow: 0 6px 20px rgba(45, 106, 79, 0.28);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(45, 106, 79, 0.34); color: var(--primary-contrast); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-ghost:hover { background: color-mix(in srgb, var(--primary) 22%, transparent); color: var(--primary); transform: translateY(-1px); }

.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }

.btn-soft { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border); }
.btn-soft:hover { background: var(--bg-elevated); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); transform: translateY(-1px); }

.btn-accent { background: var(--brand-accent); color: #14231A; }
.btn-accent:hover { filter: brightness(1.05); transform: translateY(-1px); }

.btn-sm { padding: 8px 14px; font-size: var(--fs-13); border-radius: 10px; }
.btn-lg { padding: 16px 30px; font-size: var(--fs-16); border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; border-radius: 12px; }
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon.btn-sm { padding: 8px; }
.btn-icon.btn-sm svg { width: 17px; height: 17px; }

/* Ripple */
.btn .ripple-ink {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transform: scale(0);
  animation: ripple 0.6s var(--ease-out);
  pointer-events: none;
}
.btn-ghost .ripple-ink, .btn-outline .ripple-ink { background: rgba(45, 106, 79, 0.25); }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition) var(--ease-out), box-shadow var(--transition) ease, border-color var(--transition) ease;
}
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-flat { box-shadow: none; }
.card-pad-sm { padding: var(--space-4); }
.card-pad-lg { padding: var(--space-8); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.card-head h3 { font-size: var(--fs-16); font-weight: var(--fw-semibold); }
.card-head .card-sub { font-size: var(--fs-12); color: var(--text-secondary); }

.card-glass {
  background: color-mix(in srgb, var(--bg-card) 72%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  box-shadow: var(--shadow-md);
}

/* KPI / Stat cards */
.kpi-card { position: relative; overflow: hidden; }
.kpi-card .kpi-label { font-size: var(--fs-13); color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.kpi-card .kpi-value { font-size: var(--fs-32); font-weight: var(--fw-extrabold); letter-spacing: -0.02em; margin-top: 8px; }
.kpi-card .kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-12); font-weight: var(--fw-semibold); margin-top: 8px; padding: 4px 10px; border-radius: var(--radius-pill); }
.kpi-card .kpi-delta.up { color: var(--success); background: var(--success-bg); }
.kpi-card .kpi-delta.down { color: var(--danger); background: var(--danger-bg); }
.kpi-card .kpi-icon {
  position: absolute;
  top: var(--space-5); right: var(--space-5);
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
}
.kpi-card .kpi-icon svg { width: 22px; height: 22px; }
.kpi-card .kpi-icon.accent { background: rgba(212, 163, 115, 0.2); color: var(--brand-accent); }
.kpi-card .kpi-icon.secondary { background: rgba(58, 110, 165, 0.14); color: var(--info); }
.kpi-card .kpi-icon.danger { background: var(--danger-bg); color: var(--danger); }

/* Chart card */
.chart-card .chart-wrap { position: relative; height: 280px; }
.chart-card .chart-wrap.sm { height: 220px; }
.chart-card .chart-wrap.xl { height: 340px; }

/* ============================================================
   Forms
   ============================================================ */
.field { margin-bottom: var(--space-5); }
.field label { display: block; font-size: var(--fs-14); font-weight: var(--fw-medium); margin-bottom: 8px; color: var(--text-primary); }
.field .hint { font-size: var(--fs-12); color: var(--text-disabled); margin-top: 6px; }
.field .error-msg { font-size: var(--fs-12); color: var(--danger); margin-top: 6px; display: none; }
.field.invalid .error-msg { display: flex; align-items: center; gap: 6px; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }

.input-wrap { position: relative; }
.input-wrap > svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--text-disabled);
  pointer-events: none;
}
.input-wrap > svg ~ input, .input-wrap > svg ~ select { padding-left: 44px; }
.input-wrap .toggle-pwd {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  padding: 6px;
  color: var(--text-disabled);
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.input-wrap .toggle-pwd:hover { color: var(--text-primary); }
.input-wrap .toggle-pwd svg { width: 18px; height: 18px; }

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-input);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--fs-14);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
input::placeholder, textarea::placeholder { color: var(--text-disabled); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
select { appearance: none; cursor: pointer; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 16px; top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
textarea { resize: vertical; min-height: 100px; }

.checkbox-row { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-14); }
.checkbox-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

/* Password strength */
.pwd-meter { display: flex; gap: 6px; margin-top: 8px; }
.pwd-meter span { height: 4px; flex: 1; border-radius: 4px; background: var(--bg-surface); transition: background var(--transition) ease; }
.pwd-meter[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.pwd-meter[data-score="2"] span:nth-child(-n+2) { background: var(--warning); }
.pwd-meter[data-score="3"] span:nth-child(-n+3) { background: var(--info); }
.pwd-meter[data-score="4"] span:nth-child(-n+4) { background: var(--success); }
.pwd-label { font-size: var(--fs-12); margin-top: 6px; color: var(--text-disabled); }

/* ============================================================
   Badges / Status pills
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success { color: var(--success); background: var(--success-bg); }
.badge.danger { color: var(--danger); background: var(--danger-bg); }
.badge.warning { color: var(--warning); background: var(--warning-bg); }
.badge.info { color: var(--info); background: var(--info-bg); }
.badge.neutral { color: var(--text-secondary); background: var(--bg-surface); }
.badge.plain::before { display: none; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg-card); }
table.data-table { min-width: 640px; }
.data-table th {
  text-align: left;
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-disabled);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  white-space: nowrap;
}
.data-table td {
  padding: 14px 16px;
  font-size: var(--fs-14);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--transition-fast) ease; }
.data-table tbody tr:hover { background: var(--bg-surface); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .cell-main { font-weight: var(--fw-medium); color: var(--text-primary); }
.data-table .cell-sub { font-size: var(--fs-12); color: var(--text-secondary); }
.data-table .cell-amount { font-weight: var(--fw-semibold); }
.data-table .amount-pos { color: var(--success); }
.data-table .amount-neg { color: var(--danger); }

/* Table toolbar */
.table-toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.table-toolbar .search-box { max-width: 300px; flex: 1; }

/* ============================================================
   Pagination
   ============================================================ */
.pagination { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: var(--space-6); flex-wrap: wrap; }
.pagination button {
  min-width: 38px; height: 38px;
  padding-inline: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  transition: all var(--transition-fast) ease;
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-ellipsis { color: var(--text-disabled); padding-inline: 4px; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(8, 14, 10, 0.55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: var(--space-5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition) ease;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
  transform: translateY(24px) scale(0.97);
  transition: transform var(--transition) var(--ease-out);
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }
.modal.modal-sm { max-width: 400px; }
.modal.modal-lg { max-width: 720px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.modal-head h3 { font-size: var(--fs-20); font-weight: var(--fw-bold); }
.modal-head .modal-sub { font-size: var(--fs-13); color: var(--text-secondary); margin-top: 4px; }
.modal-close {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  background: var(--bg-surface);
  transition: all var(--transition-fast) ease;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); transform: rotate(90deg); }
.modal-close svg { width: 18px; height: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-6); }

/* ============================================================
   Toast
   ============================================================ */
.toast-stack {
  position: fixed;
  top: 20px; right: 20px;
  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);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  color: var(--text-primary);
  padding: 14px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 380px;
  pointer-events: auto;
  animation: toastIn 0.4s var(--ease-spring);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast .toast-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }
.toast .toast-body { flex: 1; }
.toast .toast-title { font-size: var(--fs-14); font-weight: var(--fw-semibold); }
.toast .toast-msg { font-size: var(--fs-13); color: var(--text-secondary); }
.toast.out { animation: toastOut 0.35s var(--ease-out) forwards; }

/* ============================================================
   Dropdown menu
   ============================================================ */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast) var(--ease-out);
  z-index: 60;
}
.dropdown.open .dropdown-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.dropdown-menu a, .dropdown-menu button.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: var(--fs-14);
  color: var(--text-primary);
  text-align: left;
  transition: background var(--transition-fast);
}
.dropdown-menu a:hover, .dropdown-menu button.menu-item:hover { background: var(--bg-surface); }
.dropdown-menu a svg, .dropdown-menu button.menu-item svg { width: 17px; height: 17px; color: var(--text-secondary); }
.dropdown-menu .menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.dropdown-menu .menu-item.danger { color: var(--danger); }
.dropdown-menu .menu-item.danger svg { color: var(--danger); }
.dropdown-menu .menu-header { padding: 8px 12px 6px; font-size: var(--fs-12); color: var(--text-disabled); }

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  padding: 12px 18px;
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: var(--fw-semibold); }
.tab-panel { display: none; padding-top: var(--space-6); }
.tab-panel.active { display: block; animation: fadeIn var(--transition) ease; }

/* ============================================================
   Accordion
   ============================================================ */
.accordion { display: flex; flex-direction: column; gap: var(--space-3); }
.acc-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.acc-item.open { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: var(--shadow-sm); }
.acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5);
  text-align: left;
  font-size: var(--fs-16);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
.acc-icon {
  width: 28px; height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--bg-surface);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  transition: transform var(--transition) var(--ease-out), background var(--transition-fast), color var(--transition-fast);
}
.acc-icon svg { width: 16px; height: 16px; }
.acc-item.open .acc-icon { transform: rotate(45deg); background: var(--primary); color: var(--primary-contrast); }
.acc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition) var(--ease-out);
}
.acc-body-inner { padding: 0 var(--space-5) var(--space-5); color: var(--text-secondary); font-size: var(--fs-14); line-height: var(--lh-loose); }

/* ============================================================
   Carousel (testimonials)
   ============================================================ */
.carousel { position: relative; }
.carousel-track { display: flex; overflow: hidden; }
.carousel-slide {
  min-width: 100%;
  transition: transform 0.6s var(--ease-out);
}
.carousel-dots { display: flex; justify-content: center; gap: 8px; margin-top: var(--space-6); }
.carousel-dots button {
  width: 8px; height: 8px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  transition: all var(--transition) var(--ease-out);
}
.carousel-dots button.active { width: 26px; background: var(--primary); }
.carousel-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-md); display: grid; place-items: center; color: var(--text-primary); transition: all var(--transition-fast); z-index: 2; }
.carousel-nav:hover { background: var(--primary); color: var(--primary-contrast); }
.carousel-nav.prev { left: -20px; }
.carousel-nav.next { right: -20px; }
.carousel-nav svg { width: 18px; height: 18px; }

/* ============================================================
   Progress
   ============================================================ */
.progress { height: 8px; border-radius: var(--radius-pill); background: var(--bg-surface); overflow: hidden; }
.progress-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--gradient-brand);
  transition: width 0.8s var(--ease-out);
  position: relative;
}
.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: shimmer 1.6s infinite;
}

/* Progress ring */
.progress-ring { position: relative; width: 120px; height: 120px; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring .ring-bg { stroke: var(--bg-surface); }
.progress-ring .ring-fg {
  stroke: var(--primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s var(--ease-out);
}
.progress-ring .ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}
.progress-ring .ring-center b { font-size: var(--fs-20); font-weight: var(--fw-extrabold); }
.progress-ring .ring-center span { font-size: var(--fs-12); color: var(--text-secondary); }

/* ============================================================
   Skeletons / Shimmer
   ============================================================ */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--skeleton-base);
  border-radius: 10px;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--skeleton-shine), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}
.skeleton.circle { border-radius: 50%; }
.skeleton.line { height: 14px; }
.skeleton.line-sm { height: 10px; }
.skeleton.line-lg { height: 22px; }
.skeleton.block { height: 140px; border-radius: var(--radius-card); }

/* ============================================================
   Empty states
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
}
.empty-state .empty-art {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: grid;
  place-items: center;
  color: var(--primary);
  margin-bottom: var(--space-5);
  animation: float 4s ease-in-out infinite;
}
.empty-state .empty-art svg { width: 52px; height: 52px; }
.empty-state h3 { font-size: var(--fs-20); margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); max-width: 380px; font-size: var(--fs-14); margin-bottom: var(--space-5); }

/* ============================================================
   Avatars
   ============================================================ */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--fs-14);
  font-weight: var(--fw-bold);
  color: var(--primary-contrast);
  background: var(--gradient-brand);
  flex-shrink: 0;
  position: relative;
}
.avatar.sm { width: 32px; height: 32px; font-size: var(--fs-12); }
.avatar.lg { width: 64px; height: 64px; font-size: var(--fs-24); }
.avatar.xl { width: 96px; height: 96px; font-size: var(--fs-32); }
.avatar .avatar-online {
  position: absolute;
  bottom: 0; right: 0;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-card);
}
.avatar-soft { background: var(--primary-soft); color: var(--primary); }

/* ============================================================
   Search box
   ============================================================ */
.search-box { position: relative; }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-disabled); }
.search-box input { padding-left: 42px; }

/* ============================================================
   Switch (toggle)
   ============================================================ */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; gap: 10px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 46px; height: 26px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  transition: background var(--transition) ease;
  position: relative;
  flex-shrink: 0;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition) var(--ease-spring);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: var(--shadow-glow); }

/* ============================================================
   Theme toggle
   ============================================================ */
.theme-toggle {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  position: relative;
  overflow: hidden;
  transition: all var(--transition) var(--ease-out);
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-2px); }
.theme-toggle svg { width: 20px; height: 20px; position: absolute; transition: transform 0.5s var(--ease-spring), opacity 0.3s ease; }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.4); }
[data-theme="dark"] .theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.4); }
[data-theme="dark"] .theme-toggle .icon-moon { opacity: 1; transform: rotate(0) scale(1); }

/* ============================================================
   Notification bell
   ============================================================ */
.notif-bell { position: relative; }
.notif-bell .bell-dot {
  position: absolute;
  top: 6px; right: 6px;
  min-width: 18px; height: 18px;
  padding-inline: 4px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #fff;
  font-size: var(--fs-11);
  font-weight: var(--fw-bold);
  display: grid;
  place-items: center;
  border: 2px solid var(--bg-card);
}
.notif-panel { width: 360px; max-height: 420px; overflow-y: auto; padding: 0; }
.notif-panel .notif-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-card); }
.notif-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--transition-fast); }
.notif-item:hover { background: var(--bg-surface); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item .notif-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--primary-soft); color: var(--primary); }
.notif-item .notif-ico svg { width: 19px; height: 19px; }
.notif-item .notif-ico.danger { background: var(--danger-bg); color: var(--danger); }
.notif-item .notif-ico.warning { background: var(--warning-bg); color: var(--warning); }
.notif-item .notif-ico.secondary { background: var(--info-bg); color: var(--info); }
.notif-item .notif-text b { font-size: var(--fs-14); font-weight: var(--fw-semibold); display: block; }
.notif-item .notif-text p { font-size: var(--fs-13); color: var(--text-secondary); margin-top: 2px; }
.notif-item .notif-time { font-size: var(--fs-12); color: var(--text-disabled); margin-top: 4px; }
.notif-item .unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-left: auto; flex-shrink: 0; align-self: center; }

/* ============================================================
   Investment / package cards
   ============================================================ */
.invest-card { position: relative; overflow: hidden; display: flex; flex-direction: column; }
.invest-card .invest-img {
  height: 150px;
  border-radius: 14px;
  margin-bottom: var(--space-5);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.invest-card .invest-img svg { width: 56px; height: 56px; color: var(--primary-contrast); }
.invest-card .invest-img .img-tag { position: absolute; top: 12px; left: 12px; }
.invest-card .invest-body { flex: 1; display: flex; flex-direction: column; }
.invest-card .invest-title { font-size: var(--fs-18); font-weight: var(--fw-bold); }
.invest-card .invest-meta { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-block: var(--space-5); }
.invest-card .invest-meta .meta-item span { font-size: var(--fs-12); color: var(--text-disabled); display: block; }
.invest-card .invest-meta .meta-item b { font-size: var(--fs-15); font-weight: var(--fw-semibold); }
.invest-card .invest-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }

/* Filter chips */
.chip-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chip {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  transition: all var(--transition-fast) ease;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }

/* ============================================================
   Timeline / activity
   ============================================================ */
.timeline { position: relative; padding-left: var(--space-6); }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: var(--space-5); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -22px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--bg-app);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.timeline-item.danger::before { background: var(--danger); box-shadow: 0 0 0 2px var(--danger-bg); }
.timeline-item.warning::before { background: var(--warning); box-shadow: 0 0 0 2px var(--warning-bg); }
.timeline-item .tl-title { font-size: var(--fs-14); font-weight: var(--fw-semibold); }
.timeline-item .tl-text { font-size: var(--fs-13); color: var(--text-secondary); margin-top: 2px; }
.timeline-item .tl-time { font-size: var(--fs-12); color: var(--text-disabled); margin-top: 4px; }

/* ============================================================
   Misc
   ============================================================ */
.divider { height: 1px; background: var(--border); border: none; margin-block: var(--space-5); }

.icon-wrap {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}
.icon-wrap svg { width: 22px; height: 22px; }
.icon-wrap.accent { background: rgba(212, 163, 115, 0.2); color: var(--brand-accent); }
.icon-wrap.secondary { background: var(--info-bg); color: var(--info); }
.icon-wrap.danger { background: var(--danger-bg); color: var(--danger); }

.list-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding-block: 12px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row { min-width: 0; }
.list-row > * { min-width: 0; }

/* ---------- Anti-overflow utilities (mobile) ----------
   Allow flex/grid children to shrink below their content's min-content so
   long values wrap or truncate instead of forcing horizontal scroll. */
.min-w-0 { min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-main, .cell-sub { min-width: 0; overflow-wrap: break-word; }
.grid > * { min-width: 0; }

.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.tooltip {
  position: relative;
}
.tooltip[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--text-primary);
  color: var(--bg-app);
  font-size: var(--fs-12);
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast) ease;
  z-index: 50;
}
.tooltip[data-tip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

.copy-field { display: flex; gap: var(--space-2); }
.copy-field input { font-family: monospace; font-size: var(--fs-13); flex: 1 1 auto; min-width: 0; }

.kbd {
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--bg-surface);
  font-size: var(--fs-12);
  font-family: inherit;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.ok { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.status-dot.warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
