/* frontend/static/css/main.css */

/* ═══════════════════════════════════════════════
   TOKENS & DESIGN SYSTEM
═══════════════════════════════════════════════ */
:root {
  /* Brand */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-900: #1e1b4b;

  /* Sidebar */
  --sidebar-bg:       #0f172a;
  --sidebar-bg2:      #1e293b;
  --sidebar-border:   #1e293b;
  --sidebar-text:     #94a3b8;
  --sidebar-active:   #6366f1;
  --sidebar-hover:    #1e293b;
  --sidebar-width:    260px;
  --sidebar-width-sm: 72px;

  /* Surface */
  --bg-body:    #f1f5f9;
  --bg-card:    #ffffff;
  --bg-card2:   #f8fafc;
  --border:     #e2e8f0;
  --border-2:   #cbd5e1;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-white:     #ffffff;

  /* Status */
  --success:   #10b981;
  --success-bg:#d1fae5;
  --warning:   #f59e0b;
  --warning-bg:#fef3c7;
  --danger:    #ef4444;
  --danger-bg: #fee2e2;
  --info:      #3b82f6;
  --info-bg:   #dbeafe;

  /* Stat cards */
  --card-blue:   #3b82f6;
  --card-green:  #10b981;
  --card-red:    #ef4444;
  --card-orange: #f59e0b;

  /* Navbar */
  --navbar-h: 64px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / .10), 0 1px 2px -1px rgb(0 0 0 / .10);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .10), 0 2px 4px -2px rgb(0 0 0 / .10);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .10), 0 4px 6px -4px rgb(0 0 0 / .10);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / .10), 0 8px 10px -6px rgb(0 0 0 / .10);

  /* Radius */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Font */
  --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions */
  --transition: 200ms cubic-bezier(.4,0,.2,1);
  --transition-slow: 350ms cubic-bezier(.4,0,.2,1);
}

/* ═══════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
.fw-600 { font-weight: 600; }

/* ═══════════════════════════════════════════════
   APP LAYOUT (Sidebar + Content)
═══════════════════════════════════════════════ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.app-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
}

.main-area {
  flex: 1;
  padding: 24px 28px;
  max-width: 1600px;
  width: 100%;
}

/* ═══════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition-slow), width var(--transition-slow);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

/* Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.brand-icon {
  width: 36px; height: 36px;
  background: var(--brand-600);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #f1f5f9;
}

.sidebar-toggle-close {
  background: none; border: none;
  color: var(--sidebar-text);
  font-size: 18px; cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
}
.sidebar-toggle-close:hover { color: #fff; background: #1e293b; }

/* User block */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}

.user-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-400));
  color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.user-info {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.user-name {
  color: #e2e8f0;
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: .65rem;
  background: #1e3a5f;
  color: #93c5fd;
  padding: 1px 6px;
  border-radius: 20px;
  align-self: flex-start;
  font-weight: 500;
  letter-spacing: .3px;
}

/* Nav sections */
.sidebar-nav {
  flex: 1;
  padding: 12px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-label {
  display: block;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #475569;
  padding: 10px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  position: relative;
  white-space: nowrap;
}

.nav-item i {
  font-size: 16px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.nav-item span:not(.nav-badge) {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.nav-item.active {
  background: rgba(99,102,241,.15);
  color: #a5b4fc;
}

.nav-item.active i { color: var(--brand-400); }

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--brand-400);
  border-radius: 0 3px 3px 0;
}

/* Badge */
.nav-badge {
  margin-left: auto;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  background: var(--brand-600);
  color: #fff;
  min-width: 20px;
  text-align: center;
}

.nav-badge.warning { background: var(--warning); color: #1a1a1a; }

/* Footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid #1e293b;
  flex-shrink: 0;
}

.logout-item {
  color: #f87171 !important;
}
.logout-item:hover {
  background: rgba(239,68,68,.1) !important;
  color: #fca5a5 !important;
}

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}

/* ═══════════════════════════════════════════════
   NAVBAR
═══════════════════════════════════════════════ */
.app-navbar {
  height: var(--navbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.navbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.navbar-toggle {
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 20px; cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  display: none;
}

.navbar-toggle:hover { background: var(--bg-card2); color: var(--text-primary); }

.navbar-btn {
  position: relative;
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 18px; cursor: pointer;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.navbar-btn:hover { background: var(--bg-card2); color: var(--text-primary); }

.notification-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.navbar-clock {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-secondary);
  background: var(--bg-card2);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.navbar-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none; border: none;
  color: var(--text-primary);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.navbar-user-btn:hover { background: var(--bg-card2); }

.user-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-400));
  color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Notification dropdown */
.notif-dropdown { box-shadow: var(--shadow-xl); border: 1px solid var(--border); }
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item {
  display: flex; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.notif-item:hover { background: var(--bg-card2); }
.notif-item:last-child { border-bottom: none; }

/* ═══════════════════════════════════════════════
   BREADCRUMBS
═══════════════════════════════════════════════ */
.breadcrumb-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  font-size: .8rem;
  color: var(--text-muted);
}
.breadcrumb-wrap a { color: var(--brand-600); }
.breadcrumb-wrap a:hover { text-decoration: underline; }
.breadcrumb-wrap .sep { color: var(--border-2); }
.breadcrumb-wrap .current { color: var(--text-secondary); font-weight: 500; }

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

.page-header-left h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 2px;
  letter-spacing: -.4px;
}

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

/* ═══════════════════════════════════════════════
   STAT CARDS (Dashboard top row)
═══════════════════════════════════════════════ */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-color, var(--brand-500));
}

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

.stat-card-body h2 {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 2px;
  letter-spacing: -.5px;
  font-family: var(--font-mono);
}

.stat-card-body p {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.stat-card-body small {
  font-size: .75rem;
  color: var(--text-muted);
}

.stat-card-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--card-color-bg, #eef2ff);
  color: var(--card-color, var(--brand-600));
  flex-shrink: 0;
}

/* Color variants */
.stat-card.blue  { --card-color: var(--card-blue);  --card-color-bg: #dbeafe; }
.stat-card.green { --card-color: var(--success);    --card-color-bg: var(--success-bg); }
.stat-card.red   { --card-color: var(--danger);     --card-color-bg: var(--danger-bg); }
.stat-card.orange{ --card-color: var(--warning);    --card-color-bg: var(--warning-bg); }

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

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
}

.card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i { color: var(--brand-600); }

.card-body { padding: 20px; }

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card2);
}

/* ═══════════════════════════════════════════════
   DASHBOARD GRID
═══════════════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-grid-full {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* ═══════════════════════════════════════════════
   STATUS PANEL
═══════════════════════════════════════════════ */
.status-list { display: flex; flex-direction: column; gap: 14px; }

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.status-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .875rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green  { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.status-dot.red    { background: var(--danger);  box-shadow: 0 0 0 3px var(--danger-bg); }
.status-dot.orange { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); }
.status-dot.blue   { background: var(--info);    box-shadow: 0 0 0 3px var(--info-bg); }

.status-count {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════
   RECENT EVENTS
═══════════════════════════════════════════════ */
.events-list { display: flex; flex-direction: column; gap: 0; }

.event-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.event-item:last-child { border-bottom: none; }

.event-time {
  font-size: .75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 42px;
}

.event-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.event-icon.entrada { background: var(--success-bg); color: var(--success); }
.event-icon.saida   { background: var(--info-bg);    color: var(--info); }
.event-icon.atraso  { background: var(--warning-bg); color: var(--warning); }
.event-icon.extra   { background: var(--danger-bg);  color: var(--danger); }

.event-body { flex: 1; min-width: 0; }
.event-body strong { font-size: .85rem; font-weight: 600; display: block; }
.event-body small  { font-size: .75rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.data-table thead th {
  background: var(--bg-card2);
  color: var(--text-muted);
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-card2); }

.data-table tbody td {
  padding: 12px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

/* ═══════════════════════════════════════════════
   BADGES & STATUS
═══════════════════════════════════════════════ */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .3px;
}

.badge-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-status.success { background: var(--success-bg); color: #065f46; }
.badge-status.warning { background: var(--warning-bg); color: #92400e; }
.badge-status.danger  { background: var(--danger-bg);  color: #991b1b; }
.badge-status.info    { background: var(--info-bg);     color: #1e40af; }
.badge-status.secondary { background: #f1f5f9; color: #475569; }

/* ═══════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand-600);
  color: #fff;
  border-color: var(--brand-600);
}
.btn-primary:hover {
  background: var(--brand-700);
  border-color: var(--brand-700);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
}

.btn-secondary {
  background: #fff;
  color: var(--text-secondary);
  border-color: var(--border-2);
}
.btn-secondary:hover {
  background: var(--bg-card2);
  color: var(--text-primary);
  border-color: var(--border-2);
}

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

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

.btn-sm { padding: 5px 11px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 7px 9px; }

/* ═══════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════ */
.form-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  display: block;
}

.form-control, .form-select {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

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

.input-group {
  display: flex;
  align-items: stretch;
}
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ═══════════════════════════════════════════════
   FILTERS BAR
═══════════════════════════════════════════════ */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-chip:hover, .filter-chip.active {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-700);
}

/* ═══════════════════════════════════════════════
   AVATAR STACK
═══════════════════════════════════════════════ */
.avatar-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-400));
  color: #fff;
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   RELÓGIO STATUS INDICATOR
═══════════════════════════════════════════════ */
.clock-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  font-weight: 600;
}

.pulse-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.pulse-dot.online  { background: var(--success); }
.pulse-dot.offline { background: var(--danger); }

.pulse-dot.online::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--success);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%   { opacity: 1; transform: scale(1); }
  70%  { opacity: 0; transform: scale(1.8); }
  100% { opacity: 0; transform: scale(1.8); }
}

/* ═══════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════ */
.alerts-container {
  margin-bottom: 16px;
}

.alert {
  border-radius: var(--radius);
  border: none;
  font-size: .875rem;
  font-weight: 500;
  padding: 12px 16px;
}

/* ═══════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════ */
.app-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: .75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin: 0 0 6px; }
.empty-state p  { font-size: .875rem; margin: 0; }

/* ═══════════════════════════════════════════════
   CHART WRAPPER
═══════════════════════════════════════════════ */
.chart-wrap {
  position: relative;
  height: 240px;
}

/* ═══════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════ */
body.login-layout {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.5);
}

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

.login-logo-icon {
  width: 44px; height: 44px;
  background: var(--brand-600);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
}

.login-logo-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.3px;
}

.login-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #e2e8f0;
  margin: 0 0 4px;
  text-align: center;
}

.login-card .subtitle {
  text-align: center;
  font-size: .85rem;
  color: #94a3b8;
  margin-bottom: 28px;
}

.login-form .form-label { color: #94a3b8; }

.login-form .form-control {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.12);
  color: #fff;
  padding: 11px 14px;
}

.login-form .form-control::placeholder { color: #475569; }

.login-form .form-control:focus {
  background: rgba(255,255,255,.12);
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(99,102,241,.25);
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--brand-600);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 6px;
}

.btn-login:hover {
  background: var(--brand-700);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(99,102,241,.4);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: .8rem;
  color: #64748b;
}
.login-footer a { color: var(--brand-400); }
.login-footer a:hover { text-decoration: underline; }

.login-error {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .85rem;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ═══════════════════════════════════════════════
   ERROR PAGE
═══════════════════════════════════════════════ */
body.error-layout {
  background: var(--bg-body);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.error-box {
  text-align: center;
  padding: 40px;
}
.error-code {
  font-size: 6rem;
  font-weight: 900;
  color: var(--brand-200);
  line-height: 1;
  font-family: var(--font-mono);
}
.error-box h2 { font-size: 1.4rem; font-weight: 700; margin: 8px 0 12px; }
.error-box p  { color: var(--text-muted); margin-bottom: 24px; }

/* ═══════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════ */
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info)    !important; }
.text-muted   { color: var(--text-muted) !important; }

.bg-success-soft { background: var(--success-bg); }
.bg-danger-soft  { background: var(--danger-bg); }
.bg-warning-soft { background: var(--warning-bg); }
.bg-info-soft    { background: var(--info-bg); }

.mono { font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.spinner {
  width: 20px; height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Fade in animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .3s ease forwards; }

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

@media (max-width: 992px) {
  .app-content { margin-left: 0; }
  .navbar-toggle { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }

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

  .sidebar-overlay.open {
    display: block;
  }

  .main-area { padding: 16px; }
}

@media (max-width: 768px) {
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .dashboard-grid-full { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .login-card { padding: 32px 24px; margin: 16px; }
}

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