/* ============================================================
   OLT Management System - Premium Admin Theme
   ZTE C320 OLT Manager
   ============================================================ */

:root {
  --sidebar-bg: #0f172a;
  --sidebar-bg-2: #111c33;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: linear-gradient(135deg, #6366f1, #8b5cf6);
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --success-soft: #d1fae5;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --info: #0ea5e9;
  --info-soft: #e0f2fe;
  --purple: #8b5cf6;
  --purple-soft: #ede9fe;
  --slate: #64748b;
  --slate-soft: #e2e8f0;
  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.16);
  --sidebar-w: 256px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--accent); color: #fff; }

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

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

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
}

.brand-logo {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
  flex-shrink: 0;
}

.brand-name { line-height: 1.15; }
.brand-name b { display: block; color: #f1f5f9; font-size: 15px; letter-spacing: 0.3px; }
.brand-name span { font-size: 10.5px; color: #718096; text-transform: uppercase; letter-spacing: 1px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 14px 20px; }

.nav-group { margin-bottom: 18px; }
.nav-group-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #475569;
  padding: 10px 12px 6px;
  font-weight: 700;
}

.nav-item { position: relative; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}

.nav-link i { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-link:hover { background: var(--sidebar-hover); color: #e2e8f0; }

.nav-link.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: var(--danger);
  color: #fff;
  padding: 1px 7px;
  border-radius: 20px;
}

.sidebar-user {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user .avatar {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.sidebar-user .meta b { display: block; color: #e2e8f0; font-size: 12.5px; line-height: 1.2; }
.sidebar-user .meta span { font-size: 10.5px; color: #718096; }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  height: 66px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-title { font-size: 16px; font-weight: 700; color: var(--text); }
.topbar-title small { display: block; font-size: 11px; color: var(--text-muted); font-weight: 500; }

.topbar-spacer { flex: 1; }

.btn-burger {
  display: none;
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text);
}

.topbar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}
.topbar-user .avatar {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.topbar-user b { font-size: 12.5px; }
.topbar-user span { font-size: 10.5px; color: var(--text-muted); }

/* ---------- Content ---------- */
.page {
  padding: 26px 28px 40px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 20px; font-weight: 800; }
.page-header p { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   Components
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-header h3 { font-size: 15px; font-weight: 700; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent-soft); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.08); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-danger-outline { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-soft); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { filter: brightness(1.08); }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { filter: brightness(1.08); }
.btn-dark { background: #334155; color: #fff; }
.btn-dark:hover { filter: brightness(1.15); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 14px;
}

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-success { background: var(--success-soft); color: #059669; }
.badge-danger { background: var(--danger-soft); color: #dc2626; }
.badge-warning { background: var(--warning-soft); color: #d97706; }
.badge-info { background: var(--info-soft); color: #0284c7; }
.badge-purple { background: var(--purple-soft); color: #7c3aed; }
.badge-slate { background: var(--slate-soft); color: #475569; }
.badge-neutral { background: #e2e8f0; color: #334155; }
.badge-neutral::before { display: none; }

/* ---------- Stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card .stat-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}
.stat-card .stat-value { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-top: 3px; }
.stat-icon.ic-indigo { background: var(--accent-soft); color: var(--accent); }
.stat-icon.ic-green { background: var(--success-soft); color: var(--success); }
.stat-icon.ic-red { background: var(--danger-soft); color: var(--danger); }
.stat-icon.ic-amber { background: var(--warning-soft); color: var(--warning); }
.stat-icon.ic-sky { background: var(--info-soft); color: var(--info); }
.stat-icon.ic-purple { background: var(--purple-soft); color: var(--purple); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  white-space: nowrap;
}
.table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Forms ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 700; color: #475569; }
.form-control {
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 11.5px; color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--danger); }

/* checkbox switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5e1; border-radius: 24px;
  transition: 0.2s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 18px; width: 18px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%;
  transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------- Search bar ---------- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 14px;
  width: 280px;
  max-width: 100%;
}
.search-bar i { color: var(--text-muted); }
.search-bar input { border: none; outline: none; background: transparent; flex: 1; font-size: 13px; }

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}
.filter-bar select, .filter-bar .form-control { width: auto; min-width: 140px; }

/* ---------- Alert ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-size: 13px;
  border: 1px solid;
}
.alert i { font-size: 16px; margin-top: 1px; }
.alert-success { background: var(--success-soft); border-color: #a7f3d0; color: #047857; }
.alert-danger { background: var(--danger-soft); border-color: #fecaca; color: #b91c1c; }
.alert-warning { background: var(--warning-soft); border-color: #fde68a; color: #b45309; }
.alert-info { background: var(--info-soft); border-color: #bae6fd; color: #0369a1; }

/* ---------- Terminal ---------- */
.terminal {
  background: #0b1220;
  color: #4ade80;
  border-radius: 12px;
  padding: 18px;
  font-family: "JetBrains Mono", "Consolas", "Monaco", monospace;
  font-size: 12.5px;
  line-height: 1.6;
  overflow: auto;
  max-height: 480px;
  white-space: pre-wrap;
  word-break: break-word;
}
.terminal.danger { color: #f87171; }
.terminal-title {
  display: flex; align-items: center; gap: 8px;
  font-family: inherit;
  background: #020617; color: #94a3b8;
  padding: 10px 16px; border-radius: 12px 12px 0 0;
  font-size: 12px;
  border-bottom: 1px solid #1e293b;
}
.terminal-title i { color: #f87171; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: transparent;
  border-top: none; border-left: none; border-right: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal.lg { max-width: 780px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; border-radius: 16px 16px 0 0;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg); color: var(--text-muted);
  border: none; font-size: 15px;
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 22px; }
.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0; background: #fff; border-radius: 0 0 16px 16px;
}

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .active {
  background: var(--sidebar-active);
  color: #fff; border-color: transparent;
}

/* ---------- Progress / utilization ---------- */
.util-bar { height: 8px; border-radius: 8px; background: var(--border); overflow: hidden; }
.util-bar > div { height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.util-bar > div.warn { background: linear-gradient(90deg, #f59e0b, #f97316); }
.util-bar > div.danger { background: linear-gradient(90deg, #ef4444, #f97316); }

/* ---------- Detail grid ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.detail-item {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.detail-item dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-muted); font-weight: 700; }
.detail-item dd { font-size: 13.5px; font-weight: 700; margin-top: 4px; word-break: break-all; }

/* ---------- Port grid ---------- */
.port-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.port-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  transition: all 0.15s ease;
}
.port-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.port-card .port-title { font-weight: 700; font-size: 13.5px; display: flex; justify-content: space-between; align-items: center; }
.port-card .port-count { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.port-card .util-bar { margin-top: 10px; }

/* ---------- Login ---------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #312e81 100%);
  position: relative;
  overflow: hidden;
  padding: 20px;
}
.auth-body::before {
  content: "";
  position: absolute;
  width: 560px; height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35), transparent 65%);
  top: -180px; right: -160px;
}
.auth-body::after {
  content: "";
  position: absolute;
  width: 480px; height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.28), transparent 65%);
  bottom: -160px; left: -140px;
}
.auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 410px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 22px;
  padding: 40px 36px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}
.auth-logo {
  width: 58px; height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  margin: 0 auto 18px;
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.45);
}
.auth-title { text-align: center; font-size: 21px; font-weight: 800; color: var(--text); }
.auth-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin: 6px 0 26px; }
.auth-footer { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 22px; }
.auth-hint {
  margin-top: 16px;
  padding: 12px;
  background: var(--info-soft);
  border: 1px solid #bae6fd;
  border-radius: 10px;
  font-size: 12px;
  color: #0369a1;
  line-height: 1.7;
}
.auth-hint b { font-family: monospace; }

/* ---------- Toast ---------- */
#toast-container {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 380px;
  border-left: 4px solid var(--accent);
  animation: toast-in 0.3s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.success i { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error i { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning i { color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast.info i { color: var(--info); }
.toast span { font-size: 13px; font-weight: 600; }
.toast button {
  margin-left: auto;
  background: transparent; border: none;
  color: var(--text-muted); font-size: 14px;
}
@keyframes toast-in { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.out { animation: toast-out 0.3s ease forwards; }
@keyframes toast-out { to { transform: translateX(40px); opacity: 0; } }

/* ---------- Utility ---------- */
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; } .mb-4 { margin-bottom: 26px; }
.ml-auto { margin-left: auto; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 12px; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.font-mono { font-family: "JetBrains Mono", "Consolas", monospace; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.logo-text { font-family: "Inter", sans-serif; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-dark { border: 2px solid rgba(15,23,42,0.2); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Sync Loader Overlay ---------- */
.sync-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.sync-overlay.show { display: flex; }
.sync-overlay .sync-box {
  background: #fff;
  border-radius: 16px;
  padding: 30px 38px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  max-width: 360px;
}
.sync-overlay .sync-spinner {
  width: 44px; height: 44px;
  border: 4px solid rgba(99,102,241,.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 18px;
}
.sync-overlay .sync-title { font-weight: 700; font-size: 15px; color: var(--text); margin-bottom: 6px; }
.sync-overlay .sync-sub { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.sync-overlay .sync-sub i { margin-right: 4px; }


.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; color: #cbd5e1; }
.empty-state h4 { color: var(--text); font-weight: 700; margin-bottom: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .btn-burger { display: block; }
  .topbar { padding: 0 18px; }
  .page { padding: 18px 16px 32px; }
}
@media (max-width: 720px) {
  .form-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar-user b, .topbar-user span { display: none; }
  .search-bar { width: 100%; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; align-items: stretch; }
}