:root {
  --bg-primary: #0a0e27;
  --bg-secondary: #151932;
  --bg-tertiary: #1e2139;
  --bg-card: rgba(30, 33, 57, 0.6);

  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --text-muted: #718096;

  --accent-primary: #667eea;
  --accent-secondary: #764ba2;
  --accent-success: #48bb78;
  --accent-warning: #ed8936;
  --accent-danger: #f56565;

  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Login Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.4s ease-out;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
}

.login-logo svg {
  flex-shrink: 0;
}

.login-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.login-field label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-field input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-family: inherit;
  transition: var(--transition);
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.login-error {
  color: var(--accent-danger);
  font-size: 0.8125rem;
  text-align: center;
  padding: 0.5rem;
  background: rgba(245, 101, 101, 0.1);
  border-radius: var(--radius-sm);
}

.login-btn {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  padding: 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  margin-top: 0.5rem;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Logout Button */
.logout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-btn:hover {
  background: rgba(245, 101, 101, 0.15);
  color: var(--accent-danger);
}

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

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 1000;
  transition: var(--transition);
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.desktop-sidebar-toggle {
  position: fixed;
  top: 12px;
  left: 260px;
  z-index: 1001;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 0;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  transition: left 0.3s ease, background-color 0.2s;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  font-size: 10px;
}

.desktop-sidebar-toggle:hover {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
}

body.sidebar-collapsed .desktop-sidebar-toggle {
  left: 0;
}

body.sidebar-collapsed .main-wrapper {
  margin-left: 0;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo svg {
  color: var(--accent-primary);
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: none;
}

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

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  font-size: 0.9375rem;
  font-weight: 500;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  opacity: 0;
  transition: var(--transition);
}

.nav-item:hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(102, 126, 234, 0.15);
  color: var(--text-primary);
}

.nav-item.active::before {
  opacity: 1;
}

.nav-item svg {
  flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

.app-switcher {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

.app-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  color: var(--text-secondary);
  background: var(--bg-hover);
  border: 2px solid transparent;
  transition: all 0.2s;
}

.app-circle:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
  background: rgba(102, 126, 234, 0.15);
}

.app-circle.active {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: rgba(102, 126, 234, 0.2);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main Wrapper */
.main-wrapper {
  flex: 1;
  margin-left: 260px;
  transition: var(--transition);
}

.sidebar.collapsed+.main-wrapper {
  margin-left: 0;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header */
.header {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo svg {
  color: var(--accent-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.select-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.select-input:hover {
  border-color: var(--accent-primary);
}

.select-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-refresh:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-refresh:active {
  transform: translateY(0);
}

.auto-refresh {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auto-refresh-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: var(--transition);
  border-radius: 50%;
}

input:checked+.slider {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border-color: transparent;
}

input:checked+.slider:before {
  transform: translateX(24px);
  background-color: white;
}

.last-update {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  gap: 1rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--bg-tertiary);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-state p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Error State */
.error-state {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent-danger);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  max-width: 500px;
  margin: 2rem auto;
}

.error-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.error-state h3 {
  color: var(--accent-danger);
  margin-bottom: 0.5rem;
}

.error-state p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.btn-retry {
  background: var(--accent-danger);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-retry:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
  opacity: 0;
  transition: var(--transition);
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(102, 126, 234, 0.3);
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.metric-content {
  flex: 1;
}

.metric-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.metric-change {
  font-size: 0.75rem;
  font-weight: 500;
}

.metric-change.positive {
  color: var(--accent-success);
}

.metric-change.negative {
  color: var(--accent-danger);
}

/* Charts Section */
.charts-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.chart-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* Table Section */
.table-section {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.search-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-family: inherit;
  width: 250px;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

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

.data-table thead {
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--border-color);
}

.data-table th {
  padding: 1rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(102, 126, 234, 0.05);
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.status-active {
  background: rgba(72, 187, 120, 0.2);
  color: var(--accent-success);
}

.status-paused {
  background: rgba(237, 137, 54, 0.2);
  color: var(--accent-warning);
}

.text-center {
  text-align: center;
}

.text-success {
  color: var(--accent-success);
}

.text-danger {
  color: var(--accent-danger);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .charts-section {
    grid-template-columns: 1fr;
  }

  .table-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-input {
    width: 100%;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.metric-card,
.chart-card,
.table-section {
  animation: fadeIn 0.5s ease-out;
}

/* Page Content */
.page-content {
  animation: fadeIn 0.4s ease-out;
}

.page-header {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.date-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-family: inherit;
  transition: var(--transition);
}

.date-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.date-picker-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  flex: 0 0 auto;
}

.date-picker-group .date-input {
  width: 150px;
  min-width: 150px;
}

.btn-date-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-date-picker:hover {
  border-color: var(--accent-primary);
  background: rgba(102, 126, 234, 0.12);
}

.date-native-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.table-summary {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.day-focus-row {
  cursor: pointer;
}

.day-focus-row:hover {
  background: rgba(102, 126, 234, 0.1) !important;
}

.day-focus-row.selected {
  background: rgba(102, 126, 234, 0.2) !important;
}

/* Placeholder Content */
.placeholder-content {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  text-align: center;
  margin-top: 2rem;
}

.placeholder-content svg {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.placeholder-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.placeholder-content p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Mobile Responsive Updates */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .sidebar-toggle {
    display: block;
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .select-input,
  .page-actions .btn-refresh {
    flex: 1;
  }
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.breadcrumb-item {
  font-size: 0.8125rem;
  color: var(--text-muted);
  transition: var(--transition);
}

.breadcrumb-item.clickable {
  color: var(--accent-primary);
  cursor: pointer;
  text-decoration: none;
}

.breadcrumb-item.clickable:hover {
  color: #8fa4f0;
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: var(--text-secondary);
  font-weight: 500;
}

.breadcrumb-separator {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 0 0.25rem;
}

/* Drill-down clickable rows */
.drilldown-row {
  cursor: pointer;
  transition: var(--transition);
}

.drilldown-row:hover {
  background: rgba(102, 126, 234, 0.1) !important;
}

.drilldown-row td:first-child {
  color: var(--accent-primary);
  font-weight: 500;
}

.drilldown-row:hover td:first-child {
  text-decoration: underline;
}

.drilldown-icon {
  display: inline-block;
  margin-left: 0.5rem;
  opacity: 0;
  transition: var(--transition);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.drilldown-row:hover .drilldown-icon {
  opacity: 1;
}

/* ===== Sync Data Page ===== */
.sync-status-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.sync-status-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.375rem 0;
}

.sync-status-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  min-width: 120px;
}

.sync-status-value {
  font-size: 0.875rem;
  font-weight: 600;
}

.sync-status-ok {
  color: var(--accent-success);
}

.sync-status-warn {
  color: var(--accent-warning);
}

.sync-status-error {
  color: var(--accent-danger);
}

.sync-status-running {
  background: rgba(102, 126, 234, 0.2);
  color: var(--accent-primary);
}

.sync-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0 1.5rem;
  align-items: center;
}

.btn-sync-start {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  padding: 0.75rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-sync-start:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn-sync-cancel {
  background: transparent;
  border: 1px solid var(--accent-danger);
  border-radius: var(--radius-sm);
  color: var(--accent-danger);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-sync-cancel:hover {
  background: rgba(245, 101, 101, 0.1);
}

.sync-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  padding: 0 1.5rem;
}

.sync-progress-section {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.sync-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

#syncProgressLabel {
  font-weight: 600;
  color: var(--text-primary);
}

#syncStepLabel {
  color: var(--text-secondary);
}

.sync-progress-bar-track {
  width: 100%;
  height: 10px;
  background: var(--bg-tertiary);
  border-radius: 5px;
  overflow: hidden;
}

.sync-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 5px;
  transition: width 0.4s ease;
}

.sync-log-section {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.sync-log-title,
.sync-history-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.sync-log-area {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  max-height: 240px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
  line-height: 1.7;
}

.sync-log-entry {
  white-space: pre-wrap;
  word-break: break-word;
}

.sync-log-success { color: var(--accent-success); }
.sync-log-error { color: var(--accent-danger); }
.sync-log-warn { color: var(--accent-warning); }
.sync-log-info { color: var(--text-secondary); }

/* ===== Analytics Page ===== */
.analytics-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 0 1rem;
    overflow-x: auto;
}

.analytics-tab {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    padding: 1rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.analytics-tab:hover {
    color: var(--text-primary);
    background: rgba(102, 126, 234, 0.05);
}

.analytics-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.analytics-tab-content {
    animation: fadeIn 0.3s ease-out;
}

.sortable-th {
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.sortable-th:hover {
    color: var(--accent-primary);
    background: rgba(102, 126, 234, 0.1);
}

.data-table tfoot td {
    padding: 1rem;
    font-size: 0.875rem;
    border-top: 2px solid var(--border-color);
    background: rgba(102, 126, 234, 0.05);
}

.analytics-totals-row td {
    color: var(--text-primary);
}

.sync-history-section {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
}

/* ===== Status Tracker Page ===== */
.status-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.status-summary-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    transition: var(--transition);
}

.status-summary-card:hover {
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.status-summary-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-summary-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.375rem;
}

.status-summary-changes {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-summary-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-other {
    background: rgba(160, 174, 192, 0.2);
    color: var(--text-secondary);
}

.btn-timeline {
    background: transparent;
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    color: var(--accent-primary);
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-timeline:hover {
    background: rgba(102, 126, 234, 0.15);
}

/* Timeline Modal */
.timeline-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.timeline-modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.3s ease-out;
}

.timeline-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.timeline-modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.timeline-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: var(--transition);
}

.timeline-modal-close:hover {
    color: var(--accent-danger);
}

.timeline-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.timeline-container {
    position: relative;
    padding-left: 2rem;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.25rem;
    display: flex;
    gap: 1rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -2rem;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid;
    z-index: 1;
}

.timeline-dot-active {
    background: rgba(72, 187, 120, 0.2);
    border-color: var(--accent-success);
}

.timeline-dot-inactive {
    background: rgba(237, 137, 54, 0.2);
    border-color: var(--accent-warning);
}

.timeline-content {
    flex: 1;
}

.timeline-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.timeline-from {
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

/* ===== Settings Page ===== */
.settings-section {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    margin-top: 1.5rem;
}

.settings-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.settings-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.settings-section-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.settings-toggle-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.tracker-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.tracker-status-dot.running {
    background: var(--accent-success);
    box-shadow: 0 0 8px rgba(72, 187, 120, 0.5);
}

.tracker-status-dot.stopped {
    background: var(--text-muted);
}

.tracker-status-text {
    font-size: 0.8125rem;
    font-weight: 500;
}

.tracker-status-text.running {
    color: var(--accent-success);
}

.tracker-status-text.stopped {
    color: var(--text-muted);
}

.settings-section-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.settings-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    cursor: pointer;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--accent-danger);
    border-radius: 26px;
    transition: background 0.25s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-success);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}
.toggle-label {
    margin-left: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    vertical-align: middle;
}
