/* Месга Design System — #720AA4 / #050A24 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --mesga-purple: #720AA4;
  --mesga-purple-hover: #5e0890;
  --mesga-purple-light: #f3e8ff;
  --mesga-purple-soft: #ede5f7;
  --mesga-navy: #050A24;
  --mesga-navy-mid: #1E2130;
  --mesga-bg: #F5F6FA;
  --mesga-white: #ffffff;
  --mesga-border: #E5E7EB;
  --mesga-text: #1E2130;
  --mesga-text-secondary: #697089;
  --mesga-text-muted: #9CA3AF;
  --mesga-error: #F04438;
  --mesga-success: #12B76A;
  --mesga-warning: #F79009;
  --mesga-radius: 12px;
  --mesga-radius-sm: 8px;
  --mesga-radius-lg: 16px;
  --mesga-shadow: 0 4px 24px rgba(5, 10, 36, 0.08);
  --mesga-shadow-lg: 0 12px 48px rgba(5, 10, 36, 0.12);
  --mesga-sidebar-w: 240px;
  --mesga-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--mesga-font);
  color: var(--mesga-text);
  background: var(--mesga-bg);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--mesga-purple); text-decoration: none; }
a:hover { color: var(--mesga-purple-hover); }

img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* Typography */
.mesga-h1 { font-size: 2rem; font-weight: 800; line-height: 1.25; }
.mesga-h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.33; }
.mesga-h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; }
.mesga-body { font-size: 1rem; line-height: 1.5; }
.mesga-caption { font-size: 0.75rem; line-height: 1.33; color: var(--mesga-text-secondary); }

/* Buttons */
.mesga-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--mesga-radius-sm);
  font-weight: 600; font-size: 0.9375rem; border: none; cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
  white-space: nowrap;
}
.mesga-btn:active { transform: scale(0.98); }
.mesga-btn--primary { background: var(--mesga-purple); color: #fff; }
.mesga-btn--primary:hover { background: var(--mesga-purple-hover); }
.mesga-btn--secondary { background: #fff; color: var(--mesga-purple); border: 1.5px solid var(--mesga-purple); }
.mesga-btn--secondary:hover { background: var(--mesga-purple-light); }
.mesga-btn--ghost { background: transparent; color: var(--mesga-text-secondary); border: 1.5px solid var(--mesga-border); }
.mesga-btn--ghost:hover { border-color: var(--mesga-purple); color: var(--mesga-purple); }
.mesga-btn--danger { background: var(--mesga-error); color: #fff; }
.mesga-btn--lg { padding: 14px 32px; font-size: 1rem; border-radius: var(--mesga-radius); }
.mesga-btn--sm { padding: 8px 16px; font-size: 0.8125rem; }
.mesga-btn--icon { width: 40px; height: 40px; padding: 0; border-radius: var(--mesga-radius-sm); }
.mesga-btn--full { width: 100%; }

/* Inputs */
.mesga-field { margin-bottom: 20px; }
.mesga-label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--mesga-text-secondary); margin-bottom: 6px; }
.mesga-input-wrap { position: relative; }
.mesga-input {
  width: 100%; padding: 12px 16px 12px 44px;
  border: 1.5px solid var(--mesga-border); border-radius: var(--mesga-radius-sm);
  background: #fff; color: var(--mesga-text); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.mesga-input:focus { border-color: var(--mesga-purple); box-shadow: 0 0 0 3px rgba(114, 10, 164, 0.12); }
.mesga-input--no-icon { padding-left: 16px; }
.mesga-input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--mesga-text-muted); pointer-events: none; }
.mesga-input-toggle { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--mesga-text-muted); cursor: pointer; padding: 4px; }
.mesga-input-error { border-color: var(--mesga-error); }
.mesga-field-error { color: var(--mesga-error); font-size: 0.8125rem; margin-top: 4px; }

/* Checkbox */
.mesga-check { display: flex; align-items: flex-start; gap: 10px; font-size: 0.875rem; color: var(--mesga-text-secondary); cursor: pointer; }
.mesga-check input { width: 18px; height: 18px; accent-color: var(--mesga-purple); margin-top: 2px; flex-shrink: 0; }

/* Toggle */
.mesga-toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.mesga-toggle input { opacity: 0; width: 0; height: 0; }
.mesga-toggle span { position: absolute; inset: 0; background: #D1D5DB; border-radius: 24px; cursor: pointer; transition: .2s; }
.mesga-toggle span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.mesga-toggle input:checked + span { background: var(--mesga-purple); }
.mesga-toggle input:checked + span::before { transform: translateX(20px); }

/* Badge */
.mesga-badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.mesga-badge--purple { background: var(--mesga-purple-light); color: var(--mesga-purple); }
.mesga-badge--green { background: #ECFDF3; color: var(--mesga-success); }
.mesga-badge--orange { background: #FFF6ED; color: var(--mesga-warning); }
.mesga-badge--red { background: #FEF3F2; color: var(--mesga-error); }
.mesga-badge--blue { background: #EFF8FF; color: #2E90FA; }

/* Avatar */
.mesga-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--mesga-purple-soft); flex-shrink: 0; }
.mesga-avatar--sm { width: 32px; height: 32px; }
.mesga-avatar--lg { width: 56px; height: 56px; }
.mesga-avatar--initials { display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.875rem; color: var(--mesga-purple); }

/* Logo */
.mesga-logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: inherit; text-decoration: none; }
.mesga-logo__icon {
  width: 36px; height: 36px; border-radius: 10px; background: var(--mesga-purple);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 1.125rem;
}
.mesga-logo--white .mesga-logo__text { color: #fff; }

/* Card */
.mesga-card { background: #fff; border-radius: var(--mesga-radius); border: 1px solid var(--mesga-border); box-shadow: var(--mesga-shadow); }
.mesga-card__body { padding: 24px; }

/* Tabs */
.mesga-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--mesga-border); }
.mesga-tab {
  padding: 10px 16px; font-size: 0.875rem; font-weight: 500; color: var(--mesga-text-secondary);
  background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.mesga-tab--active { color: var(--mesga-purple); border-bottom-color: var(--mesga-purple); }

/* Unread dot */
.mesga-unread { min-width: 20px; height: 20px; border-radius: 50%; background: var(--mesga-purple); color: #fff; font-size: 0.6875rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

/* Divider */
.mesga-divider { display: flex; align-items: center; gap: 16px; color: var(--mesga-text-muted); font-size: 0.8125rem; margin: 20px 0; }
.mesga-divider::before, .mesga-divider::after { content: ''; flex: 1; height: 1px; background: var(--mesga-border); }

/* Icons inline SVG sizing */
.mesga-icon { width: 20px; height: 20px; flex-shrink: 0; }
.mesga-icon--sm { width: 16px; height: 16px; }
.mesga-icon--lg { width: 24px; height: 24px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* Utility */
.mesga-hidden { display: none !important; }
.mesga-flex { display: flex; }
.mesga-flex-center { display: flex; align-items: center; justify-content: center; }
.mesga-gap-8 { gap: 8px; }
.mesga-gap-12 { gap: 12px; }
.mesga-gap-16 { gap: 16px; }
.mesga-text-muted { color: var(--mesga-text-secondary); }
.mesga-text-purple { color: var(--mesga-purple); }
.mesga-fw-600 { font-weight: 600; }
.mesga-fw-700 { font-weight: 700; }
.mesga-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Toast */
.mesga-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: var(--mesga-navy); color: #fff; padding: 14px 20px;
  border-radius: var(--mesga-radius-sm); box-shadow: var(--mesga-shadow-lg);
  font-size: 0.875rem; animation: mesgaToastIn .3s ease;
}
@keyframes mesgaToastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Loading */
.mesga-spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: mesgaSpin .6s linear infinite; }
@keyframes mesgaSpin { to { transform: rotate(360deg); } }
