/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px; border-radius: var(--r-md); font-weight: 600; font-size: 15px;
  transition: transform var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast), opacity var(--motion-fast);
  min-height: 48px; width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.btn-primary { background: linear-gradient(135deg, var(--volet-500), var(--volet-700)); color: #fff; box-shadow: var(--shadow-float); }
.btn-secondary { background: var(--color-surface-2); color: var(--color-text-primary); }
.btn-outline { background: transparent; border: 1.5px solid var(--color-border); color: var(--color-text-primary); }
.btn-ghost { background: transparent; color: var(--volet-500); }
.btn-biz { background: linear-gradient(135deg, var(--biz-400), var(--biz-500)); color:#fff; box-shadow: var(--shadow-float); }
.btn-sm { padding: 9px 14px; font-size: 13px; min-height: 38px; width: auto; border-radius: var(--r-full); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* Card */
.card {
  background: var(--color-surface); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card); padding: var(--sp-4);
  transition: transform var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast);
}
.card.tap:active { transform: scale(0.985); box-shadow: var(--shadow-float); }

/* Badge / chip */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--r-full); font-size: 11px; font-weight: 600;
}
.badge-primary { background: var(--volet-50); color: var(--volet-600); }
.badge-success { background: rgba(52,199,89,.14); color: #1E9E4A; }
.badge-warning { background: rgba(255,149,0,.14); color: #C56E00; }
.badge-error { background: rgba(255,59,48,.12); color: #C7261C; }
.badge-verified { background: var(--volet-500); color: #fff; }
body.dark .badge-primary { background: rgba(124,58,237,.18); color: var(--volet-200); }
body.dark .badge-success { background: rgba(52,199,89,.2); color: #5CE08A; }
body.dark .badge-warning { background: rgba(255,149,0,.2); color: #FFB84D; }
body.dark .badge-error { background: rgba(255,59,48,.2); color: #FF6B61; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 8px 14px; border-radius: var(--r-full); font-size: 13px; font-weight: 600;
  background: var(--color-surface); border: 1px solid var(--color-border);
  color: var(--color-text-secondary); transition: all var(--motion-fast);
}
.chip.active { background: var(--volet-500); border-color: var(--volet-500); color: #fff; }
.chip:active { transform: scale(0.96); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px; margin: 0 -16px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display:none; }

/* Tabs */
.tabs {
  display: flex; gap: 4px; background: var(--color-surface-2);
  padding: 4px; border-radius: var(--r-full); margin-bottom: var(--sp-4);
}
.tab {
  flex: 1; text-align: center; padding: 9px 6px; border-radius: var(--r-full);
  font-size: 13px; font-weight: 600; color: var(--color-text-secondary);
  transition: all var(--motion-fast); position: relative;
}
.tab.active { background: var(--color-surface); color: var(--color-text-primary); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.tab .dot-badge { position: absolute; top: 4px; right: 10px; width: 7px; height: 7px; background: var(--color-error); border-radius: 50%; }

/* Inputs */
.input-group { margin-bottom: var(--sp-4); }
.input-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: block; color: var(--color-text-secondary); }
.input {
  width: 100%; padding: 14px 16px; border-radius: var(--r-md);
  border: 1.5px solid var(--color-border); background: var(--color-surface);
  font-size: 15px; color: var(--color-text-primary); transition: border var(--motion-fast);
}
.input:focus { outline: none; border-color: var(--volet-400); box-shadow: 0 0 0 3px var(--volet-50); }
textarea.input { resize: none; min-height: 84px; }
.input-phone { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 14px; border:1.5px solid var(--color-border); border-radius: var(--r-md); background: var(--color-surface); }
.input-phone .flag { font-size: 20px; }
.input-phone input { border: none; flex: 1; padding: 12px 8px; font-size: 15px; background: transparent; color: var(--color-text-primary); }
.input-phone input:focus { outline: none; }

/* Toggle */
.toggle { width: 46px; height: 28px; border-radius: var(--r-full); background: var(--color-border); position: relative; transition: background var(--motion-fast); flex-shrink:0; }
.toggle.on { background: var(--volet-500); }
.toggle::after { content:''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background:#fff; transition: transform var(--motion-base) var(--ease-spring); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle.on::after { transform: translateX(18px); }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-2) 25%, #ececf2 50%, var(--color-surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-md);
}
body.dark .skeleton { background: linear-gradient(90deg, #1E1830 25%, #2A2340 50%, #1E1830 75%); background-size:200% 100%; }

/* Avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; display:flex; align-items:center; justify-content:center; font-weight:700; color:#fff; overflow:hidden; flex-shrink:0; }
.avatar img { width:100%; height:100%; object-fit:cover; }

/* Logo box (business) with fallback */
.logo-box { border-radius: var(--r-md); overflow: hidden; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:700; flex-shrink:0; background: var(--volet-400); }
.logo-box img { width:100%; height:100%; object-fit:cover; }

/* Modal + Sheet */
.overlay-backdrop {
  position: absolute; inset: 0; background: rgba(15,10,35,0.45);
  backdrop-filter: blur(2px); animation: fadeIn var(--motion-base);
  display: flex; align-items: flex-end;
}
.overlay-backdrop.center { align-items: center; justify-content: center; }
.sheet {
  width: 100%; background: var(--color-surface);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0; padding: 12px 20px calc(20px + var(--sa-bottom));
  box-shadow: var(--shadow-sheet); animation: sheetUp var(--motion-slow) var(--ease-spring);
  max-height: 86%; overflow-y: auto; scrollbar-width:none;
}
.sheet.detent-medium { max-height: 55%; }
.sheet.detent-large { max-height: 86%; }
.sheet::-webkit-scrollbar{display:none;}
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--color-border); margin: 0 auto 14px; }
@keyframes sheetUp { from { transform: translateY(100%);} to { transform: translateY(0);} }
.modal-card {
  width: 86%; max-width: 340px; background: var(--color-surface);
  border-radius: var(--r-2xl); padding: 24px 20px; animation: scaleIn var(--motion-base) var(--ease-out);
  text-align: center; box-shadow: var(--shadow-float);
}

/* Toast */
#toast-wrap { position: absolute; top: 60px; left: 0; right: 0; display:flex; flex-direction:column; align-items:center; gap:8px; z-index:200; pointer-events:none; }
.toast {
  background: rgba(15,10,35,0.92); color:#fff; padding: 11px 18px; border-radius: var(--r-full);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-float);
  animation: slideUp var(--motion-base) var(--ease-out); display:flex; align-items:center; gap:8px;
  max-width: 86%;
}
.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-error); }

/* Grouped list (iOS inset table) — reads as inset grouped table on a sunken bg (P0-2) */
.grouped-bg { background: var(--color-surface-2); }
.grouped-list {
  background: var(--color-surface); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: none; margin-bottom: var(--sp-3);
}
.grouped-list > .list-row {
  padding-left: var(--sp-4); padding-right: var(--sp-4);
  position: relative; border-bottom: none;
}
/* Inset separator: starts after the icon (~56px), iOS-style */
.grouped-list > .list-row:not(:last-child)::after {
  content:''; position:absolute; left:56px; right:0; bottom:0; height:.5px;
  background: var(--separator);
}
.list-row.tap { transition: background var(--motion-fast); }
.list-row.tap:active { background: var(--color-surface-2); }

/* List rows */
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}
.list-row:last-child { border-bottom: none; }
.list-row .lr-icon { width: 40px; height: 40px; border-radius: var(--r-md); background: var(--color-surface-2); display:flex; align-items:center; justify-content:center; flex-shrink:0; color: var(--volet-500); }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-title { font-size: 14px; font-weight: 600; }
.list-row .lr-sub { font-size: 12px; color: var(--color-text-secondary); margin-top: 2px; }
.list-row .lr-chev { color: var(--color-text-tertiary); }

/* Progress */
.progress-track { height: 8px; border-radius: var(--r-full); background: var(--color-surface-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--r-full); background: linear-gradient(90deg, var(--volet-400), var(--volet-600)); transition: width 600ms var(--ease-out); }

/* Empty state */
.empty-state { text-align: center; padding: 40px 24px; }
.empty-state svg { margin: 0 auto 16px; }
.empty-state h3 { font-size: 16px; margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--color-text-secondary); }

.divider { height: 1px; background: var(--color-border); margin: var(--sp-4) 0; }
.fab {
  position: absolute; bottom: 92px; right: 18px; z-index: 40;
  width: 56px; height: 56px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--volet-400), var(--volet-600));
  color:#fff; display:flex; align-items:center; justify-content:center;
  box-shadow: var(--shadow-float); animation: scaleIn var(--motion-base);
}
body.business-mode .fab { background: linear-gradient(135deg, #0EA5E9, #2563EB); }
.fab:active { transform: scale(0.92); }
