/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Variables ── */
:root {
  --blue:         #2B7FFF;
  --blue-dark:    #1A6AE8;
  --blue-light:   #EBF2FF;
  --dark:         #0A0A0A;
  --dark-2:       #141414;
  --dark-3:       #1E1E1E;
  --gray-mid:     #5A5A5A;
  --gray-dark:    #3A3A3A;
  --text:         #1A1A1A;
  --text-muted:   #6B7280;
  --text-light:   #9CA3AF;
  --border:       #E5E7EB;
  --bg:           #F3F4F6;
  --white:        #FFFFFF;
  --success:      #059669;
  --success-bg:   #ECFDF5;
  --warning:      #B45309;
  --warning-bg:   #FFFBEB;
  --error:        #DC2626;
  --error-bg:     #FEF2F2;
  --purple:       #3C3489;
  --purple-light: #EEEDFE;
  --sidebar-w:    210px;
  --topbar-h:     54px;
}

/* ── Base ── */
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { text-decoration: none; }

/* ════════════════════════════════
   SIDEBAR
═════════════════════════════════ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--dark);
  display: flex; flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  padding: 16px;
  border-bottom: 0.5px solid rgba(255,255,255,0.08);
}

.nav { padding: 10px 0; flex: 1; overflow-y: auto; }

.nav-label {
  color: rgba(255,255,255,0.35);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 16px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9); }
.nav-item.active { background: rgba(43,127,255,0.15); color: #fff; border-left-color: var(--blue); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-bottom {
  padding: 12px 16px;
  border-top: 0.5px solid rgba(255,255,255,0.08);
}

.user-row { display: flex; align-items: center; gap: 10px; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 600; flex-shrink: 0;
}

.user-name { color: rgba(255,255,255,0.85); font-size: 12px; font-weight: 500; }
.user-role { color: rgba(255,255,255,0.4); font-size: 11px; }

.btn-logout {
  margin-left: auto; background: none; border: none;
  color: rgba(255,255,255,0.4); cursor: pointer; padding: 4px;
  transition: color 0.12s;
}
.btn-logout:hover { color: rgba(255,255,255,0.8); }

/* ════════════════════════════════
   MAIN LAYOUT
═════════════════════════════════ */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 0.5px solid var(--border);
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 15px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.content { padding: 24px; flex: 1; }

/* ════════════════════════════════
   BUTTONS
═════════════════════════════════ */
.btn-primary {
  background: var(--blue); color: #fff;
  border: none; border-radius: 8px;
  padding: 0 16px; height: 36px;
  font-size: 13px; font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: none; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0 16px; height: 36px;
  font-size: 13px; font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.btn-secondary:hover { background: var(--bg); color: var(--text); }

.btn-danger {
  background: var(--error-bg); color: var(--error);
  border: 1px solid #FECACA; border-radius: 8px;
  padding: 0 16px; height: 36px;
  font-size: 13px; font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s;
}
.btn-danger:hover { background: #FEE2E2; }

/* ════════════════════════════════
   CARDS
═════════════════════════════════ */
.card {
  background: var(--white);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.card-sub { font-size: 12px; color: var(--text-muted); }

/* ── Metric cards ── */
.metric-card {
  background: var(--white);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.metric-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.metric-icon svg { width: 18px; height: 18px; }
.metric-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.metric-value { font-size: 24px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
.metric-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.metric-up { color: var(--success); }

/* ════════════════════════════════
   BADGES
═════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 500;
  padding: 3px 10px; border-radius: 20px;
}
.badge-blue    { background: var(--blue-light); color: var(--blue); }
.badge-green   { background: var(--success-bg); color: var(--success); }
.badge-purple  { background: var(--purple-light); color: var(--purple); }
.badge-gray    { background: var(--bg); color: var(--text-muted); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-error   { background: var(--error-bg); color: var(--error); }

/* Tier badges */
.tier-starter  { background: var(--success-bg); color: var(--success); }
.tier-standard { background: var(--blue-light); color: var(--blue); }
.tier-active   { background: var(--purple-light); color: var(--purple); }
.tier-custom   { background: #FEF3C7; color: #D97706; }

/* Status dot */
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-active   { background: var(--success); }
.dot-inactive { background: var(--text-light); }
.dot-pending  { background: var(--warning); }
.dot-failed   { background: var(--error); }

/* ════════════════════════════════
   TOOLBAR (search + filters)
═════════════════════════════════ */
.toolbar {
  display: flex; align-items: center;
  gap: 12px; margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-wrap { position: relative; flex: 1; max-width: 320px; }
.search-wrap svg {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); width: 15px; height: 15px;
}
.search-input {
  width: 100%; height: 36px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: 'Inter', sans-serif;
  outline: none; background: var(--white); color: var(--text);
}
.search-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(43,127,255,0.1); }

.filter-select {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: 'Inter', sans-serif;
  outline: none; background: var(--white); color: var(--text); cursor: pointer;
}
.filter-select:focus { border-color: var(--blue); }

/* ════════════════════════════════
   TABLES
═════════════════════════════════ */
.table-wrap {
  background: var(--white);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 16px;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border);
  text-align: left;
}
tbody td {
  padding: 12px 16px;
  font-size: 13px; color: var(--text);
  border-bottom: 0.5px solid var(--border);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFAFA; }

/* ════════════════════════════════
   FORMS
═════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px; font-weight: 500;
  color: var(--text); margin-bottom: 5px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: 'Inter', sans-serif;
  outline: none; color: var(--text); background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input,
.form-group select { height: 38px; }
.form-group textarea { padding: 10px 12px; resize: vertical; min-height: 80px; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(43,127,255,0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ════════════════════════════════
   MODAL
═════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: 14px;
  width: 100%; max-width: 480px;
  padding: 28px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 6px; padding-top: 16px;
  border-top: 0.5px solid var(--border);
}

.btn-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px; border-radius: 6px;
}
.btn-close:hover { background: var(--bg); color: var(--text); }

/* ════════════════════════════════
   TOAST
═════════════════════════════════ */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--text); color: #fff;
  padding: 12px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  z-index: 300; display: none;
  animation: slideup 0.2s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--error); }
.toast.warning { background: var(--warning); }
@keyframes slideup {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════
   EMPTY & LOADING STATES
═════════════════════════════════ */
.empty-state {
  text-align: center; padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state svg {
  width: 40px; height: 40px;
  margin: 0 auto 12px; opacity: 0.3; display: block;
}
.empty-state p { font-size: 14px; }
.empty-state .hint { font-size: 12px; margin-top: 6px; color: var(--text-light); }

.loading-state {
  text-align: center; padding: 40px;
  color: var(--text-muted); font-size: 13px;
}

/* ════════════════════════════════
   QUOTA BARS
═════════════════════════════════ */
.quota-bar-wrap { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.quota-bar-fill { height: 100%; border-radius: 99px; transition: width 0.6s ease; }

/* ════════════════════════════════
   MONTH BADGE (topbar)
═════════════════════════════════ */
.month-badge {
  background: var(--blue-light); color: var(--blue);
  font-size: 12px; font-weight: 500;
  padding: 4px 12px; border-radius: 20px;
}

/* ════════════════════════════════
   LOGO (sidebar)
═════════════════════════════════ */
.sidebar-logo-img { height: 50px; width: auto; display: block; }

/* ════════════════════════════════
   RESPONSIVE
═════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Notification bell ──────────────────────────────────────────────────────── */
.nav-unread-badge {
  background: var(--error);
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  margin-left: auto;
  line-height: 14px;
}

.notif-header {
  padding: 12px 14px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 0.5px solid var(--border);
}

.notif-empty {
  padding: 16px 14px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 0.5px solid var(--border);
}

.notif-item:hover { background: var(--bg); }

.notif-item-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-item-body { flex: 1; min-width: 0; }
.notif-item-name { font-size: 12px; font-weight: 500; color: var(--text); }
.notif-item-msg  { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.notif-item-time { font-size: 10px; color: var(--text-muted); flex-shrink: 0; }

.notif-footer {
  display: block;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--blue);
  text-align: center;
  text-decoration: none;
  transition: background 0.12s;
}
.notif-footer:hover { background: var(--blue-light); }
