/* ══════════════════════════════════════════
   TrakNet.AI - Field Service Management
   Colour scheme: Dark navy + Cyan/Teal accents
   ══════════════════════════════════════════ */

:root, [data-theme="dark"] {
  --primary: #0a1628;
  --primary-light: #122240;
  --primary-dark: #060e1a;
  --accent: #00bcd4;
  --accent-light: #4dd0e1;
  --accent-dark: #0097a7;
  --success: #00c853;
  --warning: #ff9800;
  --danger: #f44336;
  --info: #2196f3;
  --text: #e0e6ed;
  --text-muted: #8899aa;
  --text-dark: #1a2332;
  --bg: #0d1b2a;
  --bg-card: #1b2838;
  --bg-input: #162231;
  --border: #1e3a5f;
  --border-light: #2a4a6b;
  --sidebar-width: 240px;
  --header-height: 56px;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
}

[data-theme="light"] {
  --primary: #ffffff;
  --primary-light: #f7f8fa;
  --primary-dark: #eef0f4;
  --text: #1a2332;
  --text-muted: #6b7685;
  --text-dark: #1a2332;
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-input: #f5f6f8;
  --border: #e0e4ea;
  --border-light: #d0d5dd;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* Keep sidebar dark in light mode for branding consistency */
[data-theme="light"] .sidebar {
  background: #0a1628 !important;
  border-right-color: #1e3a5f !important;
}
[data-theme="light"] .sidebar-brand h1,
[data-theme="light"] .sidebar-brand h1 span { color: #fff; }
[data-theme="light"] .sidebar-brand h1 span { color: #00bcd4; }
[data-theme="light"] .sidebar-brand small { color: #8899aa; }
[data-theme="light"] .sidebar-nav a { color: #8899aa; }
[data-theme="light"] .sidebar-nav a:hover { color: #e0e6ed; background: rgba(0,188,212,0.05); }
[data-theme="light"] .sidebar-nav a.active { color: #00bcd4; background: rgba(0,188,212,0.08); border-left-color: #00bcd4; }
[data-theme="light"] .sidebar-footer { border-top-color: #1e3a5f; color: #8899aa; }
[data-theme="light"] .sidebar-footer .user-info div:first-of-type + div div:first-child { color: #e0e6ed; }
[data-theme="light"] .sidebar-footer .avatar { background: #00bcd4; color: #060e1a; }
[data-theme="light"] .sidebar-footer a { color: #00bcd4; }
[data-theme="light"] .sidebar-logo { border-top-color: #1e3a5f; }

/* Light mode top bar keeps dark look too */
[data-theme="light"] .top-bar {
  background: #0a1628 !important;
  border-bottom-color: #1e3a5f !important;
}
[data-theme="light"] .top-bar .page-title { color: #e0e6ed; }
[data-theme="light"] .top-bar .search-bar input { background: #162231; border-color: #1e3a5f; color: #e0e6ed; }
[data-theme="light"] .top-bar .search-bar svg { color: #8899aa; }
[data-theme="light"] .top-bar .btn-secondary { background: #1e3a5f; color: #e0e6ed; }

/* Light mode - ensure ALL text is dark and readable */
[data-theme="light"] table thead th { background: #f7f8fa; color: #6b7685; border-bottom-color: #e0e4ea; }
[data-theme="light"] table tbody td { color: #1a2332; }
[data-theme="light"] .card-header h3 { color: #1a2332; }
[data-theme="light"] .stat-card .stat-value { color: #1a2332 !important; }
[data-theme="light"] .stat-card .stat-label { color: #6b7685; }
[data-theme="light"] h2, [data-theme="light"] h3 { color: #1a2332; }
[data-theme="light"] .form-control { color: #1a2332; background: #f5f6f8; border-color: #e0e4ea; }
[data-theme="light"] select.form-control { color: #1a2332; }
[data-theme="light"] .tab { color: #6b7685; }
[data-theme="light"] .tab.active { color: #0097a7; }
[data-theme="light"] .modal { background: #ffffff; border-color: #e0e4ea; }
[data-theme="light"] .modal-header { border-bottom-color: #e0e4ea; }
[data-theme="light"] .modal-header h2 { color: #1a2332; }
[data-theme="light"] .modal-footer { border-top-color: #e0e4ea; }
[data-theme="light"] .modal-body { color: #1a2332; }
[data-theme="light"] .pagination button { background: #fff; border-color: #e0e4ea; color: #6b7685; }
[data-theme="light"] .pagination button.active { background: #00bcd4; color: #fff; }
[data-theme="light"] .empty-state { color: #6b7685 !important; }
[data-theme="light"] .loading { color: #6b7685; }
[data-theme="light"] label { color: #4a5568; }
[data-theme="light"] .form-group label { color: #4a5568; }
[data-theme="light"] strong { color: #1a2332; }
[data-theme="light"] .search-bar input { color: #1a2332; background: #f5f6f8; border-color: #e0e4ea; }
[data-theme="light"] .login-error { color: #f44336; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-light); }

/* ── Login Page ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #0a2a3f 100%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,188,212,0.1);
}

.login-card .logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-card .logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}

.login-card .logo h1 span {
  color: var(--accent);
}

.login-card .logo p {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.login-card label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 16px;
}

.login-card input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
}

.login-card input:focus {
  border-color: var(--accent);
}

.login-card button {
  width: 100%;
  margin-top: 24px;
  padding: 12px;
  background: var(--accent);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
}

.login-card button:hover {
  background: var(--accent-light);
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  display: none;
}

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-brand {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand h1 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.sidebar-brand h1 span {
  color: var(--accent);
}

.sidebar-brand small {
  display: block;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  color: var(--text);
  background: rgba(0,188,212,0.05);
}

.sidebar-nav a.active {
  color: var(--accent);
  background: rgba(0,188,212,0.08);
  border-left-color: var(--accent);
}

.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-footer .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

.sidebar-logo {
  margin-top: 12px;
  text-align: center;
}

.sidebar-logo img {
  width: 100%;
  max-width: 160px;
  height: auto;
  border-radius: 6px;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.sidebar-logo img:hover {
  opacity: 1;
}

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

.top-bar {
  height: var(--header-height);
  background: var(--primary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar .page-title {
  font-size: 18px;
  font-weight: 600;
}

.top-bar .actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-content {
  padding: 24px 32px;
}

@media (min-width: 1200px) {
  .page-content { padding: 28px 40px; }
}

@media (min-width: 1600px) {
  .page-content { padding: 32px 48px; }
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--primary-dark);
}
.btn-primary:hover { background: var(--accent-light); }

.btn-secondary {
  background: var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--border-light); }

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

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

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
}

/* ── Stats Cards (Dashboard) ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-card .stat-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
}

.stat-card.accent::after { background: var(--accent); }
.stat-card.success::after { background: var(--success); }
.stat-card.warning::after { background: var(--warning); }
.stat-card.danger::after { background: var(--danger); }
.stat-card.info::after { background: var(--info); }

/* ── Tables ── */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--primary-light);
  border-bottom: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

table thead th:hover {
  color: var(--text);
}

table thead th .col-sort {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.4;
}

table thead th.sorted .col-sort {
  opacity: 1;
  color: var(--accent);
}

/* Column Filter Icon */
table thead th .col-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  margin-left: 4px;
  padding: 0;
  vertical-align: middle;
  transition: all 0.15s;
}

table thead th .col-filter-btn:hover {
  background: rgba(0,188,212,0.15);
  color: var(--accent);
}

/* Column Filter Dropdown */
.col-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 150;
  padding: 8px;
  animation: scaleIn 0.15s ease;
}

.col-filter-dropdown input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  margin-bottom: 6px;
  outline: none;
}

.col-filter-dropdown input[type="text"]:focus {
  border-color: var(--accent);
}

.col-filter-dropdown .filter-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  border-radius: 3px;
}

.col-filter-dropdown .filter-option:hover {
  background: rgba(0,188,212,0.08);
}

.col-filter-dropdown .filter-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Settings Dropdown */
.settings-dropdown {
  position: absolute;
  top: calc(var(--header-height) - 4px);
  right: 16px;
  width: 240px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  z-index: 200;
  padding: 8px 0;
  animation: scaleIn 0.15s ease;
  display: none;
}

.settings-dropdown.open {
  display: block;
}

.settings-dropdown a {
  display: block;
  padding: 10px 20px;
  color: var(--text);
  font-size: 13px;
  transition: background 0.1s;
}

.settings-dropdown a:hover {
  background: rgba(0,188,212,0.06);
  color: var(--accent);
}

table tbody td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

table tbody tr:hover {
  background: rgba(0,188,212,0.03);
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-cyan { background: rgba(0,188,212,0.15); color: var(--accent); }
.badge-green { background: rgba(0,200,83,0.15); color: var(--success); }
.badge-orange { background: rgba(255,152,0,0.15); color: var(--warning); }
.badge-red { background: rgba(244,67,54,0.15); color: var(--danger); }
.badge-blue { background: rgba(33,150,243,0.15); color: var(--info); }
.badge-grey { background: rgba(136,153,170,0.15); color: var(--text-muted); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Forms ── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
}

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

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238899aa' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 600px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,0.4);
}

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

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}

.pagination button {
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.pagination button:hover { border-color: var(--accent); color: var(--text); }
.pagination button.active { background: var(--accent); color: var(--primary-dark); border-color: var(--accent); }
.pagination button:disabled { opacity: 0.4; cursor: default; }

/* ── Search Bar ── */
.search-bar {
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.search-bar input:focus {
  border-color: var(--accent);
}

.search-bar svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* ── Loading ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 10px;
}

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

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text);
}

/* ── Donut Chart ── */
.chart-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chart-center-text {
  position: absolute;
  text-align: center;
}

.chart-center-text .value {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}

.chart-center-text .label {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Quick Create Button ── */
.quick-create {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--primary-dark);
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,188,212,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
  z-index: 50;
}

.quick-create:hover {
  transform: scale(1.1);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Screen visibility ── */
.screen { display: none; padding: 24px 32px; }
.screen.active { display: block; }
@media (min-width: 1200px) { .screen { padding: 28px 40px; } }
@media (max-width: 768px) { .screen { padding: 16px; } }

/* ── SaaS Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

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

/* Stat cards animate in staggered */
.stats-grid .stat-card {
  animation: fadeInUp 0.5s ease both;
}
.stats-grid .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.1s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.15s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.2s; }
.stats-grid .stat-card:nth-child(5) { animation-delay: 0.25s; }
.stats-grid .stat-card:nth-child(6) { animation-delay: 0.3s; }

/* Cards animate in */
.card {
  animation: scaleIn 0.4s ease both;
}

/* Table rows animate in */
table tbody tr {
  animation: fadeIn 0.3s ease both;
}
table tbody tr:nth-child(1) { animation-delay: 0.02s; }
table tbody tr:nth-child(2) { animation-delay: 0.04s; }
table tbody tr:nth-child(3) { animation-delay: 0.06s; }
table tbody tr:nth-child(4) { animation-delay: 0.08s; }
table tbody tr:nth-child(5) { animation-delay: 0.1s; }
table tbody tr:nth-child(6) { animation-delay: 0.12s; }
table tbody tr:nth-child(7) { animation-delay: 0.14s; }
table tbody tr:nth-child(8) { animation-delay: 0.16s; }
table tbody tr:nth-child(9) { animation-delay: 0.18s; }
table tbody tr:nth-child(10) { animation-delay: 0.2s; }

/* Badges pulse on appear */
.badge {
  animation: scaleIn 0.3s ease both;
}

/* Donut chart container glow */
canvas {
  filter: drop-shadow(0 0 8px rgba(0,188,212,0.15));
}

/* Smooth hover lift on stat cards */
.stat-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* Tabs slide indicator */
.tab {
  transition: all 0.2s ease;
}
.tab.active {
  transform: translateY(-1px);
}

/* Button press effect */
.btn {
  transition: all 0.15s ease;
}
.btn:active {
  transform: scale(0.97);
}

/* Toast slide-in enhanced */
.toast {
  animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from { transform: translateX(100%) scale(0.9); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

/* Page title fade */
.page-title {
  animation: fadeIn 0.3s ease;
}

/* Sidebar nav links hover glow */
.sidebar-nav a:hover {
  text-shadow: 0 0 8px rgba(0,188,212,0.2);
}
.sidebar-nav a.active {
  text-shadow: 0 0 12px rgba(0,188,212,0.3);
}

/* Settings nav */
.settings-nav-item {
  display: block;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.settings-nav-item:hover { color: var(--text); background: rgba(0,188,212,0.04); }
.settings-nav-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(0,188,212,0.06); }

/* Kanban board */
.kanban-col { flex: 1; min-width: 220px; }
.kanban-items { transition: background 0.15s; }
.kanban-items.drag-over { background: rgba(0,188,212,0.1) !important; }

/* Slide-out Panel */
.slide-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
  opacity: 0; transition: opacity 0.3s ease;
}
.slide-overlay.active { opacity: 1; }
.slide-panel {
  position: fixed; top: 0; right: -520px; bottom: 0; width: 500px; max-width: 90vw;
  background: var(--bg, #0d1b2a); z-index: 1001; display: flex; flex-direction: column;
  box-shadow: -4px 0 30px rgba(0,0,0,0.5); transition: right 0.3s ease;
  border-left: 1px solid var(--border);
}
[data-theme="light"] .slide-panel { background: #ffffff; box-shadow: -4px 0 30px rgba(0,0,0,0.15); }
.slide-panel-body .form-group label { color: var(--text); font-size: 12px; font-weight: 600; margin-bottom: 4px; display: block; }
.slide-panel-body .form-control { background: var(--bg-input, var(--primary-light)); border: 1px solid var(--border); color: var(--text); }
[data-theme="light"] .slide-panel-body .form-control { background: #f5f6f8; border-color: #e0e4ea; color: #1a2332; }
.slide-panel-header { background: var(--bg, #0d1b2a); }
[data-theme="light"] .slide-panel-header { background: #ffffff; }
.slide-panel-footer { background: var(--bg, #0d1b2a); }
[data-theme="light"] .slide-panel-footer { background: #ffffff; }
.slide-panel.active { right: 0; }
.slide-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
}
.slide-panel-header h3 { font-size: 18px; font-weight: 600; }
.slide-close {
  background: none; border: none; color: var(--text-muted); font-size: 24px;
  cursor: pointer; padding: 4px 8px; border-radius: var(--radius);
  transition: all 0.2s;
}
.slide-close:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.slide-panel-body {
  flex: 1; overflow-y: auto; padding: 24px;
}
.slide-panel-footer {
  display: flex; justify-content: flex-end; gap: 12px;
  padding: 16px 24px; border-top: 1px solid var(--border);
}

/* Toggle Switch */
.toggle-switch {
  width: 44px; height: 24px; background: var(--border); border-radius: 12px;
  position: relative; cursor: pointer; transition: background 0.2s;
  display: inline-block;
}
.toggle-switch.on { background: var(--accent); }
.toggle-knob {
  width: 20px; height: 20px; background: #fff; border-radius: 50%;
  position: absolute; top: 2px; left: 2px; transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.on .toggle-knob { left: 22px; }

/* ── Scheduler Calendar ── */
.scheduler-view-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 5px 12px;
  font-size: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}
.scheduler-view-btn:hover { color: var(--text); }
.scheduler-view-btn.active {
  background: var(--accent);
  color: var(--primary-dark);
  font-weight: 600;
}

.scheduler-job-block:active {
  transform: scale(0.98);
}

@media (max-width: 768px) {
  #schedulerGrid > div {
    grid-template-columns: 1fr !important;
  }
}

/* GPS Tracking Pulse */
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}
