/* Rebootly Platform V5 — White Blue Theme — v2.0 Modern */
@import url('https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ─── DESIGN TOKENS ─────────────────────────────────────────────────────────── */
:root {
  /* Brand colors */
  --primary:            #0044CC;
  --primary-dark:       #0033AA;
  --primary-light:      #40D4FF;
  --primary-hover:      #0055EE;
  --gradient:           linear-gradient(135deg, #0044CC 0%, #40D4FF 100%);
  --gradient-soft:      linear-gradient(135deg, rgba(0,68,204,0.08) 0%, rgba(64,212,255,0.08) 100%);

  /* Surfaces */
  --bg:                 #f5f7fb;
  --bg-card:            #ffffff;
  --bg-sidebar:         #0a1628;
  --bg-sidebar-hover:   rgba(255,255,255,0.06);
  --bg-input:           #ffffff;
  --surface:            #ffffff;

  /* Borders */
  --border:             #e2e8f4;
  --border-hover:       #c5d0e8;
  --border-focus:       #40D4FF;

  /* Text */
  --text:               #0f1e35;
  --text-muted:         #5b708b;
  --text-light:         #8fa3be;
  --text-sidebar:       rgba(255,255,255,0.65);
  --text-sidebar-hover: rgba(255,255,255,0.95);

  /* Semantic */
  --success:            #059669;
  --success-bg:         rgba(5,150,105,0.10);
  --success-border:     rgba(5,150,105,0.25);
  --warning:            #d97706;
  --warning-bg:         rgba(217,119,6,0.10);
  --warning-border:     rgba(217,119,6,0.25);
  --danger:             #dc2626;
  --danger-bg:          rgba(220,38,38,0.10);
  --danger-border:      rgba(220,38,38,0.25);
  --info:               #2563eb;
  --info-bg:            rgba(37,99,235,0.10);
  --info-border:        rgba(37,99,235,0.25);

  /* Dimensions */
  --sidebar-width:      256px;
  --topbar-height:      60px;

  /* Shape */
  --radius-sm:          6px;
  --radius:             10px;
  --radius-lg:          14px;
  --radius-xl:          18px;
  --radius-full:        9999px;

  /* Shadows */
  --shadow-xs:          0 1px 3px rgba(15,30,53,0.06), 0 1px 2px rgba(15,30,53,0.04);
  --shadow-sm:          0 2px 8px rgba(0,68,204,0.08), 0 1px 3px rgba(15,30,53,0.06);
  --shadow:             0 4px 16px rgba(0,68,204,0.10), 0 2px 6px rgba(15,30,53,0.06);
  --shadow-md:          0 8px 24px rgba(0,68,204,0.12), 0 3px 8px rgba(15,30,53,0.06);
  --shadow-lg:          0 16px 48px rgba(0,68,204,0.14), 0 4px 12px rgba(15,30,53,0.08);
  --shadow-primary:     0 4px 16px rgba(0,68,204,0.35);

  /* Transitions */
  --transition:         0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast:    0.10s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:    0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Exo 2', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; height: auto; }

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

/* ─── SIDEBAR ─────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* Sidebar Logo */
.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-logo span:first-child {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Sidebar Nav */
.sidebar-nav {
  padding: 10px 0 16px;
  flex: 1;
}

.nav-section {
  padding: 18px 18px 5px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.28);
}

.nav-section:first-child {
  padding-top: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--text-sidebar);
  text-decoration: none;
  transition: all var(--transition-fast);
  border-radius: 0;
  font-size: 13.5px;
  font-weight: 400;
  position: relative;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  background: var(--primary-light);
  border-radius: 0 3px 3px 0;
  transition: transform var(--transition-fast);
}

.nav-item:hover {
  color: var(--text-sidebar-hover);
  background: var(--bg-sidebar-hover);
}

.nav-item.active {
  color: #ffffff;
  background: rgba(64,212,255,0.09);
  font-weight: 500;
}

.nav-item.active::before {
  transform: translateY(-50%) scaleY(1);
}

.nav-item .icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.nav-item:hover .icon,
.nav-item.active .icon {
  opacity: 1;
}

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

/* Sidebar logout zone */
.sidebar-bottom {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

/* ─── MAIN CONTENT ───────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ─── TOPBAR ─────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-avatar {
  width: 34px;
  height: 34px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
  cursor: pointer;
  box-shadow: var(--shadow-primary);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  user-select: none;
}

.topbar-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0,68,204,0.40);
}

#sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

#sidebar-toggle:hover {
  background: var(--bg);
}

/* ─── PAGE CONTENT ───────────────────────────────────────────────────────────── */
.page-content {
  padding: 28px 32px;
  flex: 1;
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── CARDS ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.card-title .card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gradient-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  border: 1px solid var(--border);
}

/* ─── KPI CARDS ──────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity var(--transition);
}

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

.kpi-card:hover::after {
  opacity: 1;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,68,204,0.20);
}

.kpi-icon.warning { background: linear-gradient(135deg, #f59e0b, #fbbf24); box-shadow: 0 4px 12px rgba(245,158,11,0.25); }
.kpi-icon.danger  { background: linear-gradient(135deg, #ef4444, #f87171); box-shadow: 0 4px 12px rgba(239,68,68,0.25); }
.kpi-icon.success { background: linear-gradient(135deg, #10b981, #34d399); box-shadow: 0 4px 12px rgba(16,185,129,0.25); }

.kpi-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 3px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

/* ─── TABLES ─────────────────────────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.table-container + .table-container { margin-top: 16px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  background: #f8fafd;
  padding: 11px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th:first-child { border-radius: var(--radius) 0 0 0; }
th:last-child  { border-radius: 0 var(--radius) 0 0; }

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

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

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover td {
  background: #f8fafb;
}

/* ─── BADGES ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-success  {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.badge-success::before  { background: var(--success); }

.badge-warning  {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}
.badge-warning::before  { background: var(--warning); }

.badge-danger   {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.badge-danger::before   { background: var(--danger); }

.badge-info     {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}
.badge-info::before     { background: var(--info); }

.badge-neutral  {
  background: rgba(91,112,139,0.10);
  color: var(--text-muted);
  border: 1px solid rgba(91,112,139,0.18);
}
.badge-neutral::before  { background: var(--text-light); }

.badge-secondary {
  background: rgba(91,112,139,0.10);
  color: var(--text-muted);
  border: 1px solid rgba(91,112,139,0.18);
}
.badge-secondary::before { background: var(--text-light); }

/* ─── BUTTONS ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--gradient);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0,68,204,0.25);
}

.btn-primary:hover {
  box-shadow: var(--shadow-primary);
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.btn-danger:hover {
  background: rgba(220,38,38,0.18);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.btn-success:hover {
  background: rgba(5,150,105,0.18);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

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

/* Button sizes */
.btn-sm  { padding: 5px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg  { padding: 13px 28px; font-size: 15px; border-radius: var(--radius-lg); }

/* ─── FORMS ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
  letter-spacing: 0.1px;
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 13px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  appearance: none;
}

.form-control:hover {
  border-color: var(--border-hover);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,68,204,0.12);
}

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

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b708b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-control.is-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220,38,38,0.10);
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 5px;
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--primary);
}

/* ─── TABS ───────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab-btn,
.tab-item {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-btn:hover,
.tab-item:hover {
  color: var(--text);
  background: var(--bg);
}

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

/* ─── ALERTS ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #991b1b;
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: #065f46;
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: #92400e;
}

.alert-info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: #1e3a8a;
}

/* ─── AUTH PAGES ─────────────────────────────────────────────────────────────── */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 800px 600px at 20% 20%, rgba(0,68,204,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 600px 400px at 80% 80%, rgba(64,212,255,0.05) 0%, transparent 60%);
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-md);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo span {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--text);
}

.auth-subtitle {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-light);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── LANG SWITCHER ──────────────────────────────────────────────────────────── */
.lang-switcher {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

.lang-btn {
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  text-transform: uppercase;
  transition: all var(--transition-fast);
  letter-spacing: 0.3px;
}

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

.lang-btn.active {
  background: rgba(0,68,204,0.10);
  color: var(--primary);
}

/* ─── EMPTY STATE ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.35;
  display: block;
}

.empty-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.empty-msg {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 380px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

/* ─── ADMIN SPECIFICS ─────────────────────────────────────────────────────────── */
.admin-badge {
  background: rgba(220,38,38,0.12);
  color: #dc2626;
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid rgba(220,38,38,0.20);
}

/* ─── UTILITIES ──────────────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.ml-auto { margin-left: auto; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ─── LOADING SPINNER ─────────────────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ─── MODAL ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,22,40,0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn var(--transition-fast) ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: slideUp var(--transition) ease;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

/* ─── TOOLTIP ─────────────────────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 300;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ─── SIDEBAR OVERLAY (mobile) ───────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,22,40,0.50);
  z-index: 99;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root {
    --topbar-height: 56px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.open ~ .sidebar-overlay,
  .sidebar.open + * + .sidebar-overlay {
    display: block;
  }

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

  .topbar {
    padding: 0 16px;
  }

  #sidebar-toggle {
    display: flex;
  }

  .page-content {
    padding: 16px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .kpi-value {
    font-size: 22px;
  }

  .page-header {
    margin-bottom: 16px;
  }

  .page-title {
    font-size: 19px;
  }

  .auth-box {
    padding: 28px 22px;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    padding: 16px 18px;
  }

  .tabs {
    margin-bottom: 16px;
  }

  .tab-btn, .tab-item {
    padding: 9px 12px;
    font-size: 13px;
  }
}

/* ─── PRINT ──────────────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .sidebar-toggle { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
