/* ============================================================
   Mais Networking One — Admin Backoffice CSS
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --primary:       #0076b2;
  --primary-dark:  #005a8a;
  --primary-light: #e0f0fa;
  --secondary:     #004f7c;
  --secondary-mid: #006099;
  --secondary-light: #e0f0fa;
  --sidebar-bg:    #0f1f33;
  --sidebar-width: 260px;
  --sidebar-collapsed: 64px;
  --topbar-h:      60px;
  --border:        #e2e8f0;
  --bg:            #f7f9fc;
  --card-bg:       #ffffff;
  --text-main:     #1a2332;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:        0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:     0 10px 40px rgba(0,0,0,.12);
  --transition:    .18s ease;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; font-size: 14px; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  height: 100%;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   AUTH SCREEN
   ============================================================ */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, var(--secondary) 100%);
  padding: 1rem;
}

.auth-card {
  background: #fff;
  border-radius: 20px;
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-bottom: 2rem;
}

.auth-logo-icon {
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  flex-shrink: 0;
}

.auth-logo-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  line-height: 1.2;
}

.auth-logo-text span {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: .3rem;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: .875rem;
  margin-bottom: 2rem;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition);
  z-index: 1000;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-logo {
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  min-height: var(--topbar-h);
  overflow: hidden;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: .95rem;
  flex-shrink: 0;
}

.sidebar-logo-text {
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-logo-text h2 {
  font-size: .875rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.3;
}

.sidebar-logo-text span {
  font-size: .68rem;
  color: rgba(255,255,255,.45);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 500;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .75rem 0;
}

.nav-section-label {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.25);
  padding: .75rem 1.25rem .35rem;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition);
}

.sidebar.collapsed .nav-section-label {
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem 1.25rem;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  border-radius: 0;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  user-select: none;
  margin: .1rem .5rem;
  border-radius: var(--radius-sm);
}

.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.9);
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(230, 57, 70, .35);
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.nav-item .nav-label {
  font-size: .8rem;
  font-weight: 500;
  transition: opacity var(--transition);
}

.sidebar.collapsed .nav-item .nav-label {
  opacity: 0;
  width: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  padding: .1em .45em;
  border-radius: 99px;
  line-height: 1.6;
}

.nav-item.active .nav-badge {
  background: rgba(255,255,255,.25);
}

.sidebar.collapsed .nav-badge {
  display: none;
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.07);
  padding: .75rem .5rem;
  overflow: hidden;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-user:hover { background: rgba(255,255,255,.06); }

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-user-info .name {
  font-size: .78rem;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  display: block;
}

.sidebar-user-info .role {
  font-size: .68rem;
  color: rgba(255,255,255,.4);
}

/* ---------- Main Content ---------- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

.main-content.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
}

.topbar-toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.topbar-toggle:hover {
  background: var(--bg);
  color: var(--text-main);
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.topbar-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  position: relative;
}

.topbar-btn:hover {
  background: var(--bg);
  color: var(--text-main);
}

.topbar-btn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--card-bg);
}

/* ---------- Page Content ---------- */
.page-content {
  flex: 1;
  padding: 1.75rem;
  overflow-y: auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header-left h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 .2rem;
}

.page-header-left p {
  font-size: .8rem;
  color: var(--text-muted);
  margin: 0;
}

.page-header-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-body { padding: 1.25rem; }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.card-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

/* ---------- KPI Cards ---------- */
.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.kpi-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.kpi-icon.red    { background: #fde8ea; color: var(--primary); }
.kpi-icon.blue   { background: #dbeafe; color: var(--info); }
.kpi-icon.green  { background: #d1fae5; color: var(--success); }
.kpi-icon.yellow { background: #fef3c7; color: var(--warning); }
.kpi-icon.navy   { background: var(--secondary-light); color: var(--secondary); }
.kpi-icon.purple { background: #ede9fe; color: #7c3aed; }

.kpi-body { flex: 1; min-width: 0; }

.kpi-label {
  font-size: .73rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .3rem;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: .3rem;
}

.kpi-change {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .72rem;
  font-weight: 600;
  padding: .15em .5em;
  border-radius: 99px;
}

.kpi-change.up   { background: #d1fae5; color: #059669; }
.kpi-change.down { background: #fee2e2; color: #dc2626; }
.kpi-change.neutral { background: #f1f5f9; color: var(--text-muted); }

/* ============================================================
   CHARTS
   ============================================================ */
.chart-container {
  position: relative;
  padding: 1.25rem;
}

.chart-wrapper {
  position: relative;
  width: 100%;
}

.chart-wrapper canvas {
  max-width: 100%;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.table {
  margin: 0;
  font-size: .8rem;
  white-space: nowrap;
}

.table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  border-top: none;
  white-space: nowrap;
}

.table tbody tr {
  border-color: var(--border);
  transition: background var(--transition);
}

.table tbody tr:hover { background: #f8fafc; }

.table tbody td {
  padding: .75rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-main);
}

.table tbody tr:last-child td { border-bottom: none; }

/* Member avatar in table */
.member-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--secondary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 600;
  color: var(--secondary);
  flex-shrink: 0;
}

.member-info {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.member-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: .8rem;
}

.member-email {
  font-size: .72rem;
  color: var(--text-muted);
}

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.badge {
  font-size: .68rem;
  font-weight: 600;
  padding: .2em .6em;
  border-radius: 99px;
  letter-spacing: .02em;
}

.badge-success { background: #d1fae5; color: #059669; }
.badge-danger  { background: #fee2e2; color: #dc2626; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-info    { background: #dbeafe; color: #2563eb; }
.badge-secondary { background: #f1f5f9; color: #64748b; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-navy    { background: var(--secondary-light); color: var(--secondary); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: .8rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: all var(--transition);
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.btn-secondary {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}
.btn-secondary:hover {
  background: var(--secondary-mid);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background: var(--bg);
  border-color: #cbd5e1;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--bg);
  color: var(--text-main);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.btn-sm {
  padding: .3rem .65rem;
  font-size: .73rem;
}

.btn-xs {
  padding: .2rem .5rem;
  font-size: .68rem;
  border-radius: 6px;
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  justify-content: center;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: .3rem;
  display: block;
}

.form-control, .form-select {
  font-family: 'Inter', sans-serif;
  font-size: .8rem;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, .1);
  outline: none;
}

.form-control::placeholder { color: var(--text-light); }

.form-control-sm, .form-select-sm {
  padding: .35rem .6rem;
  font-size: .75rem;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  border-radius: 0;
  flex: 1;
}

.input-group .form-control:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group .btn {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: .5rem .75rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .8rem;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: none;
}

.input-group .form-control:not(:first-child) {
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 31, 51, .55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
}

.modal-box {
  background: var(--card-bg);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease;
}

.modal-box.modal-lg { max-width: 720px; }
.modal-box.modal-sm { max-width: 420px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.modal-close {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
}

.modal-close:hover {
  background: #fee2e2;
  color: var(--danger);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: .65rem 1.1rem;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}

.toast {
  background: var(--sidebar-bg);
  color: #fff;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .5rem;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn .22s ease, toastOut .22s ease 2.8s forwards;
  max-width: 320px;
  border-left: 3px solid var(--primary);
}

.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); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.filters-bar .form-control,
.filters-bar .form-select {
  width: auto;
  min-width: 160px;
}

/* ============================================================
   GROUP CARDS
   ============================================================ */
.group-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  box-shadow: var(--shadow-sm);
}

.group-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.group-card-header {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}

.group-card-body { padding: 1.25rem; }

.group-stat {
  text-align: center;
}

.group-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  display: block;
}

.group-stat-label {
  font-size: .68rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ============================================================
   ANALYTICS
   ============================================================ */
.big-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.big-number-label {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: .3rem;
}

/* ============================================================
   CALENDAR
   ============================================================ */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-width: 700px;
}

.cal-day-header {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  padding: .5rem 0;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--bg);
}

.cal-day {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: .15rem;
  padding: .35rem;
  font-size: .75rem;
  cursor: pointer;
  transition: background var(--transition);
  min-height: 90px;
  background: #fff;
}

.cal-day:hover { background: var(--bg); }
.cal-day.other-month { background: var(--bg); }
.cal-day.other-month .cal-day-num { color: var(--text-light); }

.cal-day-num {
  align-self: flex-start;
  font-weight: 700;
  font-size: .8rem;
  line-height: 1.6;
  color: var(--text);
  min-width: 1.6em;
  text-align: center;
  border-radius: 50%;
}

.cal-day.today .cal-day-num {
  background: var(--primary);
  color: #fff;
}

.cal-event {
  width: 100%;
  font-size: .65rem;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  border-radius: 3px;
  padding: .15rem .35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

/* ============================================================
   LOADING STATES
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, #f0f4f8 25%, #e2e8f0 50%, #f0f4f8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 12px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
.skeleton-avatar { width: 32px; height: 32px; border-radius: 50%; }

.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.7);
  border-radius: var(--radius);
  z-index: 10;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: .4;
}

.empty-state h4 {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: .4rem;
}

.empty-state p {
  font-size: .8rem;
  max-width: 280px;
  margin: 0 auto;
}

/* ============================================================
   ACTIVITY FEED
   ============================================================ */
.activity-item {
  display: flex;
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  flex-shrink: 0;
  margin-top: .1rem;
}

.activity-content { flex: 1; min-width: 0; }

.activity-text {
  font-size: .78rem;
  color: var(--text-main);
  margin-bottom: .15rem;
  line-height: 1.4;
}

.activity-text strong { font-weight: 600; }

.activity-time {
  font-size: .68rem;
  color: var(--text-light);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: .78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: .5rem;
}

.pagination {
  display: flex;
  gap: .2rem;
}

.page-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: .73rem;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.page-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.page-btn:hover, .page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ============================================================
   CONFIG TABS
   ============================================================ */
.config-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.config-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid #f1f5f9;
  gap: 2rem;
}

.config-row:last-child { border-bottom: none; }

.config-row-info { flex: 1; }

.config-row-info label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-main);
  display: block;
  margin-bottom: .2rem;
}

.config-row-info p {
  font-size: .75rem;
  color: var(--text-muted);
  margin: 0;
}

.config-row-control { flex-shrink: 0; min-width: 220px; }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
  display: inline-block;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-bar-custom {
  height: 6px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
  transition: width .6s ease;
}

.progress-bar-fill.green  { background: var(--success); }
.progress-bar-fill.yellow { background: var(--warning); }
.progress-bar-fill.blue   { background: var(--info); }

/* ============================================================
   SEARCH
   ============================================================ */
.search-box {
  position: relative;
}

.search-box .search-icon {
  position: absolute;
  left: .65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  font-size: .85rem;
}

.search-box .form-control {
  padding-left: 2rem;
}

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

/* ============================================================
   UTILS
   ============================================================ */
.text-primary  { color: var(--primary) !important; }
.text-success  { color: var(--success) !important; }
.text-danger   { color: var(--danger) !important; }
.text-warning  { color: var(--warning) !important; }
.text-muted    { color: var(--text-muted) !important; }
.text-light    { color: var(--text-light) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-sm  { font-size: .78rem; }
.fs-xs  { font-size: .68rem; }

.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }

/* Truncate */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
  .page-content { padding: 1.25rem; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  /* When open on mobile, always show labels regardless of collapsed state */
  .sidebar.mobile-open .nav-item .nav-label {
    opacity: 1 !important;
    width: auto !important;
  }

  .sidebar.mobile-open .nav-section-label {
    display: block !important;
  }

  .sidebar.mobile-open .nav-badge {
    display: inline-flex !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .page-content { padding: 1rem; }

  .kpi-card { padding: 1rem; }
  .kpi-value { font-size: 1.3rem; }

  .filters-bar { gap: .5rem; }
  .filters-bar .form-control,
  .filters-bar .form-select {
    min-width: 130px;
  }

  .page-header { flex-direction: column; }
  .page-header-actions { width: 100%; }
}

@media (max-width: 576px) {
  .big-number { font-size: 1.8rem; }
  .topbar { padding: 0 1rem; }
}

/* ============================================================
   ATTENDANCE
   ============================================================ */
.attendance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.attendance-row:last-child { border-bottom: none; }

.attendance-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: .7rem;
  color: transparent;
}

.attendance-check.present {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.attendance-check.absent {
  border-color: var(--danger);
  background: #fee2e2;
  color: var(--danger);
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .topbar, .page-header-actions, .filters-bar { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .card { box-shadow: none !important; break-inside: avoid; }
}
