/* ================================================
   ALUME CLINIC — Main Stylesheet
   ================================================ */

:root {
  /* Brand Colors */
  --purple: #8B5CF6;
  --pink: #EC4899;
  --gold: #F59E0B;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;

  /* Gradient */
  --grad-main: linear-gradient(135deg, #8B5CF6, #EC4899);
  --grad-gold: linear-gradient(135deg, #F59E0B, #EF4444);
  --grad-success: linear-gradient(135deg, #10B981, #059669);

  /* Typography */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-size-base: 14px;
}

/* DARK THEME (default) */
[data-theme="dark"] {
  --bg-app: #0F0F1A;
  --bg-sidebar: #13131F;
  --bg-card: #1A1A2E;
  --bg-card2: #1E1E35;
  --bg-input: #252540;
  --bg-hover: #252540;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text-primary: #F1F1F8;
  --text-secondary: #9999BB;
  --text-muted: #6666AA;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
  --glass: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.08);
  --topbar-bg: rgba(19,19,31,0.9);
}

/* LIGHT THEME */
[data-theme="light"] {
  --bg-app: #F3F4F8;
  --bg-sidebar: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card2: #F9F9FD;
  --bg-input: #F3F4F8;
  --bg-hover: #F0F0FF;
  --border: rgba(0,0,0,0.06);
  --border2: rgba(0,0,0,0.12);
  --text-primary: #1A1A2E;
  --text-secondary: #555577;
  --text-muted: #9999AA;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.12);
  --glass: rgba(255,255,255,0.7);
  --glass-border: rgba(255,255,255,0.9);
  --topbar-bg: rgba(255,255,255,0.9);
}

/* ====== RESET & BASE ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: var(--font-size-base); scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; cursor: pointer; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
ul, ol { list-style: none; }
img { max-width: 100%; }

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ====== LOGIN SCREEN ====== */
.login-screen {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0F0F1A 0%, #1A0A2E 50%, #0F1A2E 100%);
  overflow: hidden;
}

.login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-blob {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.3; animation: blobMove 8s ease-in-out infinite;
}
.b1 { width: 400px; height: 400px; background: #8B5CF6; top: -100px; left: -100px; animation-delay: 0s; }
.b2 { width: 300px; height: 300px; background: #EC4899; bottom: -50px; right: 100px; animation-delay: 2s; }
.b3 { width: 250px; height: 250px; background: #F59E0B; top: 50%; left: 50%; transform: translate(-50%,-50%); animation-delay: 4s; }

@keyframes blobMove {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 30px) scale(0.95); }
}

.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 440px; margin: 1rem;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
  animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-logo {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 32px;
}

.logo-icon {
  width: 52px; height: 52px; flex-shrink: 0;
  background: var(--grad-main);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(139,92,246,0.4);
}
.logo-icon svg { width: 100%; height: 100%; }
.logo-icon.sm { width: 36px; height: 36px; border-radius: 10px; padding: 7px; }

.login-brand {
  font-size: 1.5rem; font-weight: 800;
  background: var(--grad-main); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.login-tagline { font-size: 0.75rem; color: rgba(255,255,255,0.5); margin-top: 2px; }

.login-title { font-size: 1.4rem; font-weight: 700; color: #fff; margin-bottom: 6px; }
.login-sub { color: rgba(255,255,255,0.5); font-size: 0.875rem; margin-bottom: 28px; }

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 0.8125rem; font-weight: 600;
  color: rgba(255,255,255,0.7); margin-bottom: 7px; letter-spacing: 0.03em;
}

.input-icon {
  position: relative;
}
.input-icon svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: rgba(255,255,255,0.4);
}
.input-icon input {
  width: 100%; padding: 13px 14px 13px 42px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: #fff; font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.input-icon input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.2);
}

.login-options {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8125rem; color: rgba(255,255,255,0.6); cursor: pointer;
}
.checkbox-label input { accent-color: var(--purple); }
.forgot-link { font-size: 0.8125rem; color: var(--pink); font-weight: 500; }

.btn-login {
  width: 100%; padding: 15px;
  background: var(--grad-main);
  color: #fff; font-size: 0.9375rem; font-weight: 700;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 8px 24px rgba(139,92,246,0.4);
  border: none;
}
.btn-login:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 12px 32px rgba(139,92,246,0.5); }
.btn-login svg { width: 18px; height: 18px; }

.login-footer { text-align: center; margin-top: 24px; font-size: 0.75rem; color: rgba(255,255,255,0.3); }

/* ====== APP SHELL ====== */
.app-shell {
  display: flex; min-height: 100vh;
}

/* ====== SIDEBAR ====== */
.sidebar {
  width: 256px; flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0;
  overflow-y: auto; overflow-x: hidden;
  transition: width 0.3s, background 0.3s;
  z-index: 100;
}
.sidebar.collapsed { width: 70px; }
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .nav-item span:not(.nav-badge),
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed .sidebar-user .user-avatar { margin: 0; }

.sidebar-header {
  padding: 20px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  overflow: hidden;
}
.sidebar-brand {
  font-size: 1rem; font-weight: 800;
  background: var(--grad-main); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.sidebar-toggle {
  padding: 6px; border-radius: 8px; color: var(--text-secondary);
  transition: background 0.2s, color 0.2s;
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-toggle svg { width: 18px; height: 18px; display: block; }

.sidebar-nav {
  flex: 1; padding: 16px 10px; overflow-y: auto;
}
.nav-section-label {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 16px 8px 6px; white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; margin-bottom: 2px;
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary);
  transition: all 0.2s; cursor: pointer; white-space: nowrap;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--grad-main);
  color: #fff;
  box-shadow: 0 4px 15px rgba(139,92,246,0.35);
}
.nav-badge {
  margin-left: auto; background: var(--purple); color: #fff;
  font-size: 0.6875rem; font-weight: 700;
  padding: 2px 7px; border-radius: 20px; flex-shrink: 0;
}
.nav-badge.warn { background: var(--warning); color: #000; }
.nav-item.active .nav-badge { background: rgba(255,255,255,0.3); }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 12px;
  transition: background 0.2s;
}
.sidebar-user:hover { background: var(--bg-hover); }

.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--grad-main); color: #fff;
  font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.user-avatar.sm { width: 32px; height: 32px; font-size: 0.7rem; }

.user-info { flex: 1; overflow: hidden; }
.user-name { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 0.6875rem; color: var(--text-muted); }

.logout-btn { padding: 6px; border-radius: 8px; color: var(--text-muted); transition: color 0.2s, background 0.2s; }
.logout-btn:hover { color: var(--danger); background: rgba(239,68,68,0.1); }
.logout-btn svg { width: 16px; height: 16px; display: block; }

/* ====== MAIN CONTENT ====== */
.main-content {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--bg-app);
  transition: background 0.3s;
}

/* ====== TOPBAR ====== */
.topbar {
  height: 64px; flex-shrink: 0;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.mobile-menu-btn { display: none; padding: 8px; border-radius: 8px; color: var(--text-secondary); }
.mobile-menu-btn svg { width: 20px; height: 20px; display: block; }
.mobile-menu-btn:hover { background: var(--bg-hover); }

.page-title-wrap { overflow: hidden; }
#pageTitle { font-size: 1.125rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.breadcrumb { font-size: 0.75rem; color: var(--text-muted); }

.search-wrap {
  position: relative; display: flex; align-items: center;
}
.search-wrap svg {
  position: absolute; left: 12px; width: 16px; height: 16px; color: var(--text-muted);
}
.search-wrap input {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 14px 9px 36px;
  font-size: 0.8125rem; color: var(--text-primary);
  width: 240px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-wrap input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139,92,246,0.15); }
.search-wrap input::placeholder { color: var(--text-muted); }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); background: var(--bg-input);
  border: 1px solid var(--border);
  transition: all 0.2s; position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border2); }
.icon-btn svg { width: 17px; height: 17px; }

.notif-btn .notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--pink); border: 2px solid var(--bg-app);
}

/* ====== PAGE AREA ====== */
.page-area {
  flex: 1; padding: 28px 28px 40px;
  overflow-y: auto; overflow-x: hidden;
}

/* ====== CARDS ====== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  transition: box-shadow 0.2s, background 0.3s;
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 0.9375rem; font-weight: 700; color: var(--text-primary); }
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ====== METRIC CARDS ====== */
.metric-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 24px; }
.metric-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px 22px; display: flex; flex-direction: column; gap: 8px;
  transition: all 0.2s; position: relative; overflow: hidden;
}
.metric-card::before {
  content: ''; position: absolute; top: 0; right: 0;
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--accent, var(--purple)); opacity: 0.1;
  transform: translate(20px, -20px);
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.metric-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent, var(--purple)); opacity: 0.95;
  margin-bottom: 4px;
}
.metric-icon svg { width: 22px; height: 22px; color: #fff; }
.metric-label { font-size: 0.8125rem; color: var(--text-secondary); font-weight: 500; }
.metric-value { font-size: 1.625rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.metric-delta {
  font-size: 0.75rem; font-weight: 600;
  display: flex; align-items: center; gap: 4px;
}
.metric-delta.up { color: var(--success); }
.metric-delta.down { color: var(--danger); }

/* ====== GRID LAYOUTS ====== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }

/* ====== BUTTONS ====== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 600; border: none;
  transition: all 0.2s; cursor: pointer; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--grad-main); color: #fff; box-shadow: 0 4px 15px rgba(139,92,246,0.3); }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(139,92,246,0.4); }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border2); }
.btn-success { background: var(--grad-success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 7px 12px; font-size: 0.8125rem; border-radius: 8px; }
.btn-xs { padding: 4px 10px; font-size: 0.75rem; border-radius: 6px; }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 8px 12px; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-outline { background: transparent; border: 1px solid var(--purple); color: var(--purple); }
.btn-outline:hover { background: rgba(139,92,246,0.1); }

/* ====== BADGES / TAGS ====== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.03em;
}
.badge-purple { background: rgba(139,92,246,0.15); color: var(--purple); }
.badge-pink { background: rgba(236,72,153,0.15); color: var(--pink); }
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--info); }
.badge-gray { background: var(--bg-input); color: var(--text-muted); }

/* ====== TABLE ====== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--border2); }
th {
  padding: 12px 14px; text-align: left;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted);
  white-space: nowrap;
}
td { padding: 13px 14px; font-size: 0.875rem; color: var(--text-primary); border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--bg-hover); }

/* ====== FORMS ====== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label { font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary); }
.form-control {
  padding: 10px 14px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-primary); font-size: 0.875rem; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s; width: 100%;
}
.form-control:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(139,92,246,0.15); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }

/* ====== MODAL ====== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }
.modal-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; width: 100%; max-width: 640px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: slideUp 0.3s ease;
}
.modal-box.modal-lg { max-width: 860px; }
.modal-box.modal-xl { max-width: 1100px; }
.modal-header {
  padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
#modalTitle { font-size: 1.0625rem; font-weight: 700; color: var(--text-primary); }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 20px 24px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  flex-shrink: 0;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ====== TOAST ====== */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 1000; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-lg); min-width: 280px; max-width: 360px;
  animation: toastIn 0.3s ease;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }
.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-text { flex: 1; font-size: 0.875rem; color: var(--text-primary); font-weight: 500; }
.toast-close { color: var(--text-muted); font-size: 1.1rem; line-height: 1; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ====== TABS ====== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 18px; font-size: 0.875rem; font-weight: 600;
  color: var(--text-secondary); border-bottom: 2px solid transparent;
  cursor: pointer; transition: all 0.2s; margin-bottom: -1px;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--purple); border-bottom-color: var(--purple); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ====== EMPTY STATE ====== */
.empty-state {
  text-align: center; padding: 60px 20px;
}
.empty-state svg { width: 64px; height: 64px; color: var(--text-muted); margin-bottom: 16px; }
.empty-state h3 { font-size: 1.0625rem; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); font-size: 0.875rem; }

/* ====== AVATAR GROUP ====== */
.avatar-name {
  display: flex; align-items: center; gap: 10px;
}
.av-circle {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--grad-main); color: #fff;
  font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ====== PAGE SECTIONS ====== */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-title { font-size: 1.125rem; font-weight: 700; color: var(--text-primary); }
.section-subtitle { font-size: 0.8125rem; color: var(--text-muted); margin-top: 2px; }

/* ====== DIVIDER ====== */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ====== STATUS DOTS ====== */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.green { background: var(--success); }
.status-dot.yellow { background: var(--warning); }
.status-dot.red { background: var(--danger); }
.status-dot.blue { background: var(--info); }
.status-dot.gray { background: var(--text-muted); }

/* ====== TIMELINE ====== */
.timeline { position: relative; padding-left: 32px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 0; bottom: 0; width: 2px; background: var(--border2); }
.timeline-item { position: relative; padding-bottom: 24px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: -21px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--bg-card); background: var(--purple);
  box-shadow: 0 0 0 2px var(--purple);
}
.timeline-dot.pink { background: var(--pink); box-shadow: 0 0 0 2px var(--pink); }
.timeline-dot.success { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-time { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.timeline-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.timeline-desc { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 3px; }

/* ====== PROGRESS BAR ====== */
.progress-bar { height: 8px; background: var(--border2); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--grad-main); border-radius: 4px; transition: width 0.5s ease; }

/* ====== FILTER BAR ====== */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 18px;
}
.filter-bar .search-input {
  flex: 1; min-width: 200px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; color: var(--text-primary); font-size: 0.875rem;
  outline: none;
}
.filter-bar .search-input:focus { border-color: var(--purple); }
.filter-select {
  padding: 8px 12px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-primary); font-size: 0.875rem; cursor: pointer; outline: none;
}

/* ====== CANVAS CHART WRAP ====== */
.chart-wrap { position: relative; }
.chart-wrap canvas { display: block; }

/* ====== RESPONSIVE ====== */
@media (max-width: 1200px) {
  .metric-cards { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%); transition: transform 0.3s; z-index: 200; }
  .sidebar.mobile-open { transform: translateX(0); }
  .mobile-menu-btn { display: flex !important; }
  .search-wrap input { width: 160px; }
  .page-area { padding: 18px 16px 32px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .metric-cards { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; gap: 10px; }
  .search-wrap { display: none; }
}

/* ====== STAT MINI (Modelos de Contrato) ====== */
.stat-mini {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 18px; display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.2s;
}
.stat-mini:hover { border-color: var(--purple); }
.stat-mini-val { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-mini-lbl { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ====== EMPTY STATE ICON ====== */
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 12px; }

/* ====== PLAN CARDS ====== */
.plan-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-top: 16px; }
.plan-card { background: var(--bg-card2); border: 1px solid var(--border2); border-radius: 16px; padding: 24px; }
.plan-card.popular { border-color: var(--purple); position: relative; }
.plan-card.popular::before {
  content: 'Popular'; position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--grad-main); color: #fff; font-size: 0.65rem; font-weight: 700;
  padding: 3px 12px; border-radius: 100px; letter-spacing: 0.1em; text-transform: uppercase;
}
.plan-name { font-weight: 700; font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.08em; }
.plan-price { font-size: 1.8rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.plan-period { font-size: 0.78rem; color: var(--text-muted); margin: 4px 0 16px; }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.plan-features li { font-size: 0.82rem; color: var(--text-secondary); padding-left: 16px; position: relative; }
.plan-features li::before { content: '✓'; position: absolute; left: 0; color: var(--success); font-weight: 700; font-size: 0.75rem; }

/* ====== TOGGLE SWITCHES (Settings) ====== */
.toggle-wrap {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-wrap:last-child { border-bottom: none; }
.toggle-label { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.toggle-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-thumb {
  position: absolute; inset: 0; background: var(--border2); border-radius: 100px; cursor: pointer; transition: all 0.3s;
}
.toggle-thumb::before {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; left: 3px; bottom: 3px; transition: transform 0.3s;
}
.toggle-switch input:checked + .toggle-thumb { background: var(--purple); }
.toggle-switch input:checked + .toggle-thumb::before { transform: translateX(20px); }

/* ====== SETTINGS LAYOUT ====== */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.settings-menu { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 8px; overflow: hidden; }
.settings-menu-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: all 0.2s;
}
.settings-menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.settings-menu-item.active { background: var(--grad-main); color: #fff; }
.settings-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.settings-section-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.settings-section-desc { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 20px; }

@media (max-width: 768px) {
  .settings-layout { grid-template-columns: 1fr; }
  .plan-cards { grid-template-columns: 1fr; }
}
