/* ============================================================
   Tehiru Aerial Systems — Battery Management
   Dark Theme CSS
   ============================================================ */

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

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-hover: #21262d;
  --border: #30363d;
  --border-light: #3d444d;
  --text-primary: #e6edf3;
  --text-muted: #8b949e;
  --text-dark: #1a1a1a;
  --accent: #f97316;
  --accent-hover: #ea6c0a;
  --accent-dim: rgba(249, 115, 22, 0.15);

  /* Status colors */
  --status-ready: #22c55e;
  --status-ready-bg: rgba(34, 197, 94, 0.12);
  --status-charging: #eab308;
  --status-charging-bg: rgba(234, 179, 8, 0.12);
  --status-in-use: #3b82f6;
  --status-in-use-bg: rgba(59, 130, 246, 0.12);
  --status-assigned: #a855f7;
  --status-assigned-bg: rgba(168, 85, 247, 0.12);
  --status-maintenance: #f97316;
  --status-maintenance-bg: rgba(249, 115, 22, 0.12);
  --status-disposed: #ef4444;
  --status-disposed-bg: rgba(239, 68, 68, 0.12);
  --status-delivered: #14b8a6;
  --status-delivered-bg: rgba(20, 184, 166, 0.12);

  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.4);
  --transition: 150ms ease;
}

html { font-size: 15px; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.sidebar {
  width: 220px;
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-logo {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  line-height: 1;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.brand-org {
  font-size: 0.78rem;
  color: var(--text-primary);
  margin-top: 2px;
  font-weight: 500;
}

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

.nav-section {
  padding: 8px 12px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.nav-link .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.main-content {
  margin-left: 220px;
  flex: 1;
  min-height: 100vh;
  padding: 24px;
  max-width: calc(100vw - 220px);
}

/* ============================================================
   PAGE HEADER
   ============================================================ */

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

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

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

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

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

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

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border);
}

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

.btn-danger {
  background: transparent;
  color: #ef4444;
  border-color: #ef4444;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
}

.btn-success {
  background: var(--status-ready);
  color: #000;
  border-color: var(--status-ready);
}

.btn-success:hover:not(:disabled) {
  background: #16a34a;
  border-color: #16a34a;
  color: white;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 6px 8px;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 18px;
}

/* ============================================================
   STATUS CARDS (Dashboard)
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

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

.stat-card:hover {
  border-color: var(--border-light);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.ready::before { background: var(--status-ready); }
.stat-card.charging::before { background: var(--status-charging); }
.stat-card.in-use::before { background: var(--status-in-use); }
.stat-card.assigned::before { background: var(--status-assigned); }
.stat-card.maintenance::before { background: var(--status-maintenance); }
.stat-card.disposed::before { background: var(--status-disposed); }
.stat-card.delivered::before { background: var(--status-delivered); }

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card.ready .stat-value { color: var(--status-ready); }
.stat-card.charging .stat-value { color: var(--status-charging); }
.stat-card.in-use .stat-value { color: var(--status-in-use); }
.stat-card.assigned .stat-value { color: var(--status-assigned); }
.stat-card.maintenance .stat-value { color: var(--status-maintenance); }
.stat-card.disposed .stat-value { color: var(--status-disposed); }
.stat-card.delivered .stat-value { color: var(--status-delivered); }

.stat-total {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

/* Clickable status badges */
.badge-clickable {
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  user-select: none;
}

.badge-clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0.9;
}

.badge-clickable::after {
  content: '▼';
  margin-left: 4px;
  font-size: 0.6rem;
  opacity: 0.7;
}

.badge-clickable:hover::after {
  opacity: 1;
}

.badge-ready {
  background: var(--status-ready-bg);
  color: var(--status-ready);
  border-color: rgba(34, 197, 94, 0.25);
}

.badge-charging {
  background: var(--status-charging-bg);
  color: var(--status-charging);
  border-color: rgba(234, 179, 8, 0.25);
}

.badge-in_use, .badge-in-use {
  background: var(--status-in-use-bg);
  color: var(--status-in-use);
  border-color: rgba(59, 130, 246, 0.25);
}

.badge-assigned {
  background: var(--status-assigned-bg);
  color: var(--status-assigned);
  border-color: rgba(168, 85, 247, 0.25);
}

.badge-maintenance {
  background: var(--status-maintenance-bg);
  color: var(--status-maintenance);
  border-color: rgba(249, 115, 22, 0.25);
}

.badge-disposed {
  background: var(--status-disposed-bg);
  color: var(--status-disposed);
  border-color: rgba(239, 68, 68, 0.25);
}

.badge-delivered {
  background: var(--status-delivered-bg);
  color: var(--status-delivered);
  border-color: rgba(20, 184, 166, 0.25);
}

.badge-pending {
  background: rgba(234, 179, 8, 0.12);
  color: #eab308;
  border-color: rgba(234, 179, 8, 0.25);
}

.badge-approved {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.25);
}

.badge-denied {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.25);
}

.badge-completed {
  background: rgba(139, 148, 158, 0.12);
  color: #8b949e;
  border-color: rgba(139, 148, 158, 0.25);
}

.badge-active {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.25);
}

.badge-paused {
  background: rgba(234, 179, 8, 0.12);
  color: #eab308;
  border-color: rgba(234, 179, 8, 0.25);
}

.badge-archived {
  background: rgba(139, 148, 158, 0.08);
  color: #6b7280;
  border-color: rgba(139, 148, 158, 0.2);
}

/* ============================================================
   TABLES
   ============================================================ */

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}

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

thead th.sort-asc::after { content: ' ↑'; color: var(--accent); }
thead th.sort-desc::after { content: ' ↓'; color: var(--accent); }

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

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

tbody tr:hover { background: var(--bg-hover); }

tbody td {
  padding: 10px 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-muted { color: var(--text-muted); }
.td-mono { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 0.85rem; }

/* ============================================================
   FILTER BAR
   ============================================================ */

.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-bar input,
.filter-bar select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.filter-bar input::placeholder { 
  color: var(--text-muted);
  font-style: italic;
}

.filter-bar select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 36px;
}

.filter-bar select option { 
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 8px 12px;
}

.filter-bar input[type="search"] { 
  min-width: 250px;
  flex: 1;
  max-width: 400px;
}

.filter-bar select {
  min-width: 140px;
}

/* Mobile responsive filter bar */
@media (max-width: 768px) {
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
  }
  
  .filter-bar input[type="search"] {
    min-width: auto;
    max-width: none;
  }
  
  .filter-bar select {
    min-width: auto;
  }
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group {
  margin-bottom: 14px;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
textarea,
select {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

select option { background: var(--bg-secondary); }

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

.form-error {
  color: #ef4444;
  font-size: 0.8rem;
  margin-top: 4px;
  display: none;
}

.form-error.visible { display: block; }

.form-hint {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 4px;
}

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

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

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: modalIn 150ms ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  line-height: 1;
}

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

.modal-body {
  padding: 20px;
}

/* ============================================================
   TOASTS
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 400px;
  animation: toastIn 200ms ease;
}

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

.toast.success { border-left: 3px solid var(--status-ready); }
.toast.error { border-left: 3px solid var(--status-disposed); }
.toast.warning { border-left: 3px solid var(--status-charging); }
.toast.info { border-left: 3px solid var(--status-in-use); }

/* ============================================================
   ARCHIVE SECTIONS
   ============================================================ */

.archive-section {
  margin-bottom: 28px;
}

.archive-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.archive-section-header.ready {
  background: var(--status-ready-bg);
  color: var(--status-ready);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.archive-section-header.charging {
  background: var(--status-charging-bg);
  color: var(--status-charging);
  border: 1px solid rgba(234, 179, 8, 0.25);
}

.archive-section-header.in_use {
  background: var(--status-in-use-bg);
  color: var(--status-in-use);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.archive-section-header.assigned {
  background: var(--status-assigned-bg);
  color: var(--status-assigned);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.archive-section-header.maintenance {
  background: var(--status-maintenance-bg);
  color: var(--status-maintenance);
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.archive-section-header.disposed {
  background: var(--status-disposed-bg);
  color: var(--status-disposed);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.archive-count {
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 0.8rem;
}

.battery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.battery-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.8rem;
  font-family: monospace;
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.battery-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.battery-chip-serial { font-weight: 600; }
.battery-chip-type { color: var(--text-muted); font-size: 0.72rem; }

.battery-chip-container {
  position: relative;
  display: flex;
  flex-direction: column;
}

.battery-chip-container .battery-chip {
  margin-bottom: 4px;
}

.badge-small {
  font-size: 0.65rem;
  padding: 1px 6px;
  align-self: flex-start;
}

.battery-chip-container .badge-clickable {
  margin-top: 2px;
}

/* Enhanced battery chip styles for archive page */
.battery-chip.enhanced {
  min-height: 90px;
  gap: 4px;
  position: relative;
}

.battery-chip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.battery-chip-employee {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
}

.employee-line {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.employee-icon {
  font-size: 0.7rem;
  margin-right: 2px;
  flex-shrink: 0;
}

.employee-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.2;
  flex-shrink: 0;
}

.employee-name:hover {
  color: var(--accent);
  text-decoration: underline;
}

.employee-project {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 1px;
}

.employee-time {
  font-size: 0.58rem;
  color: var(--text-muted);
  opacity: 0.8;
  margin-left: auto;
  flex-shrink: 0;
}

/* Different styles for different assignment types */
.battery-chip-employee.employee-in-use {
  border-top-color: rgba(59, 130, 246, 0.3);
}

.battery-chip-employee.employee-in-use .employee-icon {
  color: var(--status-in-use);
}

.battery-chip-employee.employee-assigned {
  border-top-color: rgba(168, 85, 247, 0.3);
}

.battery-chip-employee.employee-assigned .employee-icon {
  color: var(--status-assigned);
}

.battery-chip-employee.employee-workstation {
  border-top-color: rgba(34, 197, 94, 0.3);
}

.battery-chip-employee.employee-workstation .employee-icon {
  color: var(--status-ready);
}

.battery-chip-employee.employee-workstation .employee-detail {
  color: var(--status-ready);
  opacity: 0.7;
}

/* Make battery grid more responsive for enhanced chips */
.archive-section .battery-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

/* Improve badge positioning in enhanced chips */
.battery-chip.enhanced .badge-small {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.6rem;
  padding: 1px 4px;
}

/* Better employee display in battery chips */
.battery-chip-employee {
  font-size: 0.72rem;
  line-height: 1.3;
}

.battery-chip-employee .employee-icon {
  display: inline;
  margin-right: 3px;
  font-weight: bold;
}

/* Animations */
@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================================================
   TIMELINE (Battery Detail)
   ============================================================ */

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 16px;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.timeline-action {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   CHECKOUT / RETURN STEPS
   ============================================================ */

.step-indicator {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
}

.step {
  flex: 1;
  text-align: center;
  padding: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  position: relative;
}

.step:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.step:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: none; }
.step:not(:first-child):not(:last-child) { border-left: none; }

.step.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(249, 115, 22, 0.4);
}

.step.done {
  background: rgba(34, 197, 94, 0.1);
  color: var(--status-ready);
  border-color: rgba(34, 197, 94, 0.3);
}

.battery-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding: 4px;
}

.battery-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.battery-select-item:hover { border-color: var(--border-light); }

.battery-select-item.selected {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.battery-select-item input[type="checkbox"] { accent-color: var(--accent); }

.battery-select-serial { font-size: 0.82rem; font-weight: 600; font-family: monospace; }

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 16px 0;
}

.page-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.875rem;
  margin-bottom: 16px;
}

/* ============================================================
   ALERTS / NOTICES
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.alert-warning {
  background: rgba(234, 179, 8, 0.1);
  border-color: rgba(234, 179, 8, 0.3);
  color: #fde68a;
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
}

/* ============================================================
   INFO GRID (Battery Detail)
   ============================================================ */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.info-item {}
.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.info-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================================
   LINKS
   ============================================================ */

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

.link-subtle {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.link-subtle:hover { color: var(--text-primary); }

/* ============================================================
   MISC UTILITIES
   ============================================================ */

.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 0.8rem; }
.font-mono { font-family: 'SFMono-Regular', Consolas, monospace; }

.gap-row { display: flex; gap: 8px; align-items: center; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   STATUS DROPDOWN
   ============================================================ */

.status-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  min-width: 160px;
  margin-top: 6px;
  display: none;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.status-dropdown.show {
  display: block;
  animation: dropdownFadeIn 200ms ease-out;
}

@keyframes dropdownFadeIn {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.status-option {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  white-space: nowrap;
  line-height: 1.2;
}

.status-option:last-child {
  border-bottom: none;
}

.status-option:hover {
  background: var(--bg-hover);
  transform: translateX(2px);
}

.status-option.current {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
}

.status-option.current::after {
  content: '✓';
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Status option colors with better contrast */
.status-option.ready { 
  color: var(--status-ready);
  border-left: 3px solid transparent;
}
.status-option.ready:hover { border-left-color: var(--status-ready); }

.status-option.charging { 
  color: var(--status-charging);
  border-left: 3px solid transparent;
}
.status-option.charging:hover { border-left-color: var(--status-charging); }

.status-option.in_use { 
  color: var(--status-in-use);
  border-left: 3px solid transparent;
}
.status-option.in_use:hover { border-left-color: var(--status-in-use); }

.status-option.assigned { 
  color: var(--status-assigned);
  border-left: 3px solid transparent;
}
.status-option.assigned:hover { border-left-color: var(--status-assigned); }

.status-option.maintenance { 
  color: var(--status-maintenance);
  border-left: 3px solid transparent;
}
.status-option.maintenance:hover { border-left-color: var(--status-maintenance); }

.status-option.disposed { 
  color: var(--status-disposed);
  border-left: 3px solid transparent;
}
.status-option.disposed:hover { border-left-color: var(--status-disposed); }

/* Mobile responsive dropdown */
@media (max-width: 768px) {
  .status-dropdown {
    position: fixed;
    top: auto;
    bottom: 20px;
    left: 20px;
    right: 20px;
    transform: none;
    min-width: auto;
    max-width: none;
    margin: 0;
    border-radius: var(--radius-lg);
  }
  
  .status-option {
    padding: 16px 20px;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
  }
  
  @keyframes dropdownFadeIn {
    0% {
      opacity: 0;
      transform: translateY(20px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  .sidebar {
    width: 200px;
  }
  .main-content {
    margin-left: 200px;
    max-width: calc(100vw - 200px);
  }
}

@media (max-width: 700px) {
  .sidebar {
    position: relative;
    width: 100%;
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  body { flex-direction: column; }
  .main-content {
    margin-left: 0;
    max-width: 100vw;
    padding: 16px;
  }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .battery-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* ============================================================
   CHECKBOX BATTERY SELECT — SELECT ALL
   ============================================================ */

.select-all-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.select-all-bar + .battery-select-grid {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 8px;
}

.selected-count {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   EMPLOYEE CHECKOUT DETAILS MODAL
   ============================================================ */

.checkout-details-grid {
  display: grid;
  gap: 16px;
}

.checkout-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.checkout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.battery-link {
  color: var(--text-primary);
  text-decoration: none;
  font-family: var(--font-mono);
}

.battery-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.checkout-details {
  display: grid;
  gap: 8px;
}

.detail-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items: start;
}

.detail-row .label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.detail-row .notes {
  font-style: italic;
  color: var(--text-muted);
}

.text-warning {
  color: var(--warning);
  font-weight: 500;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Small inline loading spinner for status updates */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Status dropdown loading state */
.status-dropdown.loading {
  pointer-events: none;
  opacity: 0.7;
}

.status-dropdown.loading .status-option:not(.updating) {
  opacity: 0.5;
}

.status-option.updating {
  background: var(--accent-dim);
  color: var(--accent);
}
