/* CSS Variables - Dark Theme (Default) */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #16213e;
  --bg-card: #1a1a2e;
  --bg-hover: #252542;

  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #6b6b80;

  --accent-primary: #6366f1;
  --accent-secondary: #818cf8;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  --border-color: #2a2a40;
  --border-radius: 12px;
  --border-radius-sm: 8px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);

  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --header-height: 70px;

  --transition: all 0.3s ease;
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eef2f7;
  --bg-card: #ffffff;
  --bg-hover: #e8ecf1;

  --text-primary: #1a1a2e;
  --text-secondary: #4a5568;
  --text-muted: #718096;

  --accent-primary: #5a5fcf;
  --accent-secondary: #6b70d4;
  --accent-gradient: linear-gradient(135deg, #5a5fcf 0%, #7c5cc9 100%);

  --border-color: #e2e8f0;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Light theme specific overrides */
[data-theme="light"] .client-avatar.client-logo {
  background: #f5f7fa;
  border: 1px solid var(--border-color);
}

[data-theme="light"] .page-client-logo {
  background: #f5f7fa;
  border: 1px solid var(--border-color);
}

[data-theme="light"] .logo-icon {
  background: #f5f7fa;
  border: 1px solid var(--border-color);
}

/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

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

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


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

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

.logo-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: var(--border-radius-sm);
}

.logo-text {
  font-weight: 600;
  font-size: 1.1rem;
  white-space: nowrap;
  transition: var(--transition);
}


/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--bg-secondary);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
  margin-bottom: 0.25rem;
}

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

.nav-item.active {
  background: var(--accent-gradient);
  color: var(--text-primary);
}

.nav-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Client Avatar */
.client-avatar {
  width: 28px;
  height: 28px;
  background: var(--bg-hover);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.nav-item.active .client-avatar {
  background: rgba(255, 255, 255, 0.2);
}

.client-avatar.client-logo {
  object-fit: contain;
  background: white;
  padding: 2px;
}

/* Logout Button */
.logout-btn {
  color: #ef4444;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* Navigation Section Title */
.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 1rem 1rem 0.5rem;
  margin-top: 0.5rem;
}

.nav-section-title:first-child {
  margin-top: 0;
}

/* Search Input */
.search-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* Sidebar Search */
.sidebar-search {
  padding: 0 0.75rem 0.5rem;
}

.clients-list {
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  overscroll-behavior: contain; /* Prevent scroll chaining to main content */
}

/* Missed Deadlines Search */
.missed-deadlines-search {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

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

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot.offline {
  background: var(--error);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 0;
  transition: var(--transition);
}


/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 50;
  height: 70px;
  box-sizing: border-box;
}

.page-title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.page-client-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: white;
  padding: 2px;
  border-radius: var(--border-radius-sm);
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn svg {
  width: 18px;
  height: 18px;
}

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

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

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

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

.btn-icon {
  padding: 0.625rem;
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.btn-icon:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* Completed Projects Toggle Button */
.completed-toggle {
  padding: 0.5rem 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  font-size: 0.75rem;
  border-radius: 20px;
  white-space: nowrap;
}

.completed-toggle:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

.completed-toggle.including {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.completed-toggle.including:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.5);
}

.completed-toggle-icon {
  width: 14px;
  height: 14px;
}

.completed-toggle-label {
  font-weight: 500;
}

/* Exclusion Note Banner */
.exclusion-note {
  position: fixed;
  top: 70px;
  left: var(--sidebar-width);
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.5rem;
  background: #2a1f0a;
  border-bottom: 1px solid #5c4a1a;
  color: #f59e0b;
  font-size: 0.75rem;
  z-index: 99;
}

.exclusion-note svg {
  flex-shrink: 0;
}

.exclusion-note.hidden {
  display: none;
}

@media (max-width: 768px) {
  .exclusion-note {
    left: 0;
  }
}

/* Pages */
.page {
  display: none;
  padding: 2rem;
  padding-top: calc(70px + 2rem); /* Account for fixed header */
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

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

/* Stats Grid */
.last-updated {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.last-updated-label {
  color: var(--text-secondary);
}

.last-updated-value {
  color: var(--text-muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

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

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-icon.blue { background: rgba(59, 130, 246, 0.2); color: var(--info); }
.stat-icon.green { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.stat-icon.orange { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.2); color: #8b5cf6; }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

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

/* Clickable stat cards */
.stat-card[data-stat-type] {
  cursor: pointer;
  position: relative;
  flex-wrap: wrap;
}

.stat-card[data-stat-type].active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn-jira-link {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: linear-gradient(135deg, #4AA8D8 0%, #3B9AC9 100%);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 0 2px 6px rgba(74, 168, 216, 0.35);
}

.btn-jira-link:hover {
  background: linear-gradient(135deg, #3B9AC9 0%, #2D8ABA 100%);
  box-shadow: 0 4px 10px rgba(74, 168, 216, 0.45);
  transform: translateY(-1px);
}

.btn-jira-small {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
}

/* Dashboard Grid - Three Column Layout aligned with stats */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.dashboard-grid .chart-card {
  grid-column: span 2;
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
}

/* Chart Styles */
.chart-card {
  overflow: visible;
}

.chart-card .card-body {
  position: relative;
  min-height: 300px;
  overflow: visible;
}

.chart-container {
  position: relative;
  height: 300px;
  display: none;
}

.chart-container.visible {
  display: block;
}

.chart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-secondary);
}

.chart-loading.hidden {
  display: none;
}

.chart-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--error);
}

.chart-error.hidden {
  display: none;
}

/* Missed Deadlines Card */
.missed-deadlines-card {
  display: flex;
  flex-direction: column;
}

.missed-deadlines-card .card-header,
.missed-deadlines-card .missed-deadlines-total,
.missed-deadlines-card .missed-deadlines-search {
  flex-shrink: 0;
}

/* When charts are expanded, the card body height is set by JavaScript */
.dashboard-grid.charts-expanded .missed-deadlines-card .card-body {
  max-height: var(--expanded-body-height, 300px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.missed-deadlines-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s;
}

.missed-deadlines-total:hover {
  background: var(--bg-hover);
}

.missed-total-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--error);
  line-height: 1;
}

.missed-total-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.missed-total-jira-btn {
  margin-top: 0.5rem;
}

.missed-deadlines-card .card-body {
  position: relative;
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.missed-deadlines-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.missed-deadline-item {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  background: var(--bg-primary);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.missed-deadline-item:hover {
  background: var(--bg-hover);
}

.missed-deadline-item.active {
  border-color: #4AA8D8;
  box-shadow: 0 0 0 2px rgba(74, 168, 216, 0.2);
}

.missed-deadline-item .clickable-item-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.missed-deadline-type {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.missed-deadline-count {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--error);
  background: rgba(239, 68, 68, 0.15);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  min-width: 40px;
  text-align: center;
}

.missed-deadlines-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-secondary);
}

.missed-deadlines-loading.hidden {
  display: none;
}

.missed-deadlines-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--error);
}

.missed-deadlines-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--success);
}

/* Department Section */
.departments-section {
  margin-top: 2rem;
}

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

.departments-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.departments-search {
  flex-shrink: 0;
}

.departments-search .search-input {
  width: 250px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

@media (max-width: 600px) {
  .departments-header {
    flex-direction: column;
    align-items: stretch;
  }

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

.department-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Limit to max 5 departments per row on large screens */
@media (min-width: 1600px) {
  .department-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

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

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

.department-card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.department-last-updated {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.department-card-body {
  padding: 1rem 1.25rem;
}

.department-categories {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.department-category {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  background: var(--bg-hover);
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.department-category:hover {
  background: var(--bg-tertiary);
}

.department-category.active {
  border-color: #4AA8D8;
  box-shadow: 0 0 0 2px rgba(74, 168, 216, 0.2);
}

.department-category .clickable-item-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.department-category-name {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.department-category-count {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 40px;
  text-align: right;
}

.department-category.highlight-red .department-category-count {
  color: var(--error);
}

.department-category.highlight-orange .department-category-count {
  color: var(--warning);
}

.department-category.highlight-green .department-category-count {
  color: var(--success);
}

.department-loading,
.department-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-muted);
}

.department-error {
  color: var(--error);
}

/* Department Chart Cards (AAT style) - 2 per row */
.department-grid:has(.department-chart-card) {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 1000px) {
  .department-grid:has(.department-chart-card) {
    grid-template-columns: 1fr;
  }
}

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

.department-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.department-chart-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.department-chart-body {
  padding: 1rem 1.25rem;
}

.department-chart-container {
  height: 300px;
  margin-bottom: 1rem;
}

.department-chart-legend {
  text-align: center;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.department-chart-total {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.department-chart-items {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-done .legend-dot {
  background-color: #10b981;
}

.legend-wip .legend-dot {
  background-color: #f59e0b;
}

.legend-late .legend-dot {
  background-color: #ef4444;
}

.department-chart-loading,
.department-chart-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
}

.department-chart-error {
  color: var(--error);
}

/* Activity List */
.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 50%;
  margin-top: 0.5rem;
  flex-shrink: 0;
}

.activity-content p {
  font-size: 0.9rem;
}

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

/* API Status */
.api-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.api-status.success {
  color: var(--success);
}

.api-status.error {
  color: var(--error);
}

/* Loading Spinner */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* Settings */
.settings-group {
  margin-bottom: 2rem;
}

.settings-group:last-child {
  margin-bottom: 0;
}

.settings-group h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.setting-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.setting-item label {
  flex: 0 0 100%;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: var(--transition);
}

.input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

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

.text-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Install Prompt */
.install-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 1rem 2rem;
  transform: translateY(100%);
  transition: var(--transition);
  z-index: 200;
}

.install-prompt.show {
  transform: translateY(0);
}

.install-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.install-actions {
  display: flex;
  gap: 0.75rem;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-hover);
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.menu-toggle:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* Body scroll lock when mobile sidebar is open */
body.sidebar-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* Responsive */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
  }

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

  .sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; /* Prevent scroll chaining to main content */
  }

  .clients-list {
    max-height: none;
    overflow-y: visible;
  }

  /* Prevent zoom on input focus (iOS requires 16px minimum) */
  input, select, textarea {
    font-size: 16px !important;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .header {
    padding: 1rem;
    gap: 0.75rem;
    left: 0; /* Full width on mobile since sidebar is hidden */
  }

  .page-title-wrapper {
    flex: 1;
    min-width: 0;
  }

  .page-title {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-client-logo {
    width: 32px;
    height: 32px;
  }

  .page {
    padding: 1rem;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

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

  .dashboard-grid .chart-card {
    grid-column: span 1;
  }

  .install-content {
    flex-direction: column;
    text-align: center;
  }
}

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

  .stat-card {
    padding: 1rem;
  }

  .btn span {
    display: none;
  }

  .btn-primary span {
    display: inline;
  }
}

/* Worktype Search Section */
.worktype-search-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  overflow: visible;
  position: relative;
  z-index: 10;
}

.worktype-search-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.worktype-search-inputs {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.worktype-controls-right {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-left: auto;
}

.worktype-time-filter {
  min-width: 130px;
}

.worktype-compare-btn {
  white-space: nowrap;
}

.worktype-search-input-wrapper {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  min-width: 250px;
  position: relative;
}

.worktype-search-input {
  flex: 1;
  max-width: 400px;
}

/* Autocomplete dropdown */
.worktype-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-width: 400px;
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  z-index: 1000;
  display: none;
  box-shadow: var(--shadow-lg);
  margin-top: 4px;
}

.worktype-autocomplete.visible {
  display: block;
}

.worktype-autocomplete-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.worktype-autocomplete-item:last-child {
  border-bottom: none;
}

.worktype-autocomplete-item:hover,
.worktype-autocomplete-item.highlighted {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.worktype-clear-btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.worktype-compare-btn {
  white-space: nowrap;
}

.worktype-compare-btn.active {
  background: var(--error);
  border-color: var(--error);
}

.worktype-compare-input {
  /* Now inline with first input */
}

.worktype-charts-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.worktype-charts-container.compare-mode {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.worktype-charts-container.compare-mode .worktype-chart-slot {
  display: block !important;
  min-width: 0;
}

@media (max-width: 900px) {
  .worktype-charts-container.compare-mode {
    grid-template-columns: 1fr;
  }
}

.worktype-chart-slot {
  /* Visibility controlled by JS */
}

.worktype-chart-card {
  background: var(--bg-tertiary);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.worktype-chart-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.worktype-chart-header h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.worktype-chart-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.worktype-chart-body {
  padding: 1.25rem;
}

.worktype-chart-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.worktype-stat {
  font-size: 0.9rem;
  font-weight: 500;
}

.worktype-stat.created {
  color: var(--info);
}

.worktype-stat.done {
  color: var(--success);
}

.worktype-chart-container {
  height: 250px;
  position: relative;
}

.worktype-chart-loading,
.worktype-chart-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-muted);
  text-align: center;
}

.worktype-chart-error {
  color: var(--error);
}

@media (max-width: 768px) {
  .worktype-search-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .worktype-search-inputs {
    flex-direction: column;
    align-items: stretch;
  }

  .worktype-controls-right {
    margin-left: 0;
    justify-content: space-between;
  }

  .worktype-time-filter {
    flex: 1;
  }

  .worktype-search-input-wrapper {
    min-width: 100%;
  }
}

/* Theme Toggle Button */
.theme-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-sm);
  background: var(--bg-hover);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--text-secondary);
}

.theme-toggle:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: var(--transition);
}

.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

[data-theme="light"] .theme-toggle .sun-icon {
  display: block;
}

[data-theme="light"] .theme-toggle .moon-icon {
  display: none;
}

/* Time Filter Dropdown */
.chart-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.chart-filter {
  flex-shrink: 0;
}

.time-filter {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0b0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.time-filter:hover {
  border-color: var(--accent-primary);
}

.time-filter:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.time-filter option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

[data-theme="light"] .time-filter {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Chart Click Popup */
.chart-popup {
  position: fixed;
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  min-width: 220px;
  overflow: hidden;
}

.chart-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.chart-popup-date {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.chart-popup-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

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

.chart-popup-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
}

.chart-popup-btn {
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
}

.chart-popup-btn[data-type="created"] {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.chart-popup-btn[data-type="created"]:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.chart-popup-btn[data-type="done"] {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.chart-popup-btn[data-type="done"]:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* Make chart canvas clickable */
.chart-container canvas {
  cursor: pointer;
}

/* Login Screen */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-screen.hidden {
  display: none;
}

.login-container {
  background: rgba(26, 26, 46, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  text-align: center;
}

.login-logo {
  margin-bottom: 1.5rem;
}

.login-logo img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  filter: drop-shadow(0 4px 20px rgba(74, 168, 216, 0.3));
  background: rgba(255, 255, 255, 0.1);
}

.login-title {
  color: #ffffff;
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 2rem;
  letter-spacing: -0.5px;
}

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

.login-input-group {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #6b6b80;
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  color: #a0a0b0;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.password-toggle .eye-off-icon {
  display: none;
}

.password-toggle.visible .eye-icon {
  display: none;
}

.password-toggle.visible .eye-off-icon {
  display: block;
}

.login-input {
  width: 100%;
  padding: 1rem 3rem 1rem 1.25rem;
  background: rgba(15, 15, 26, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #ffffff;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.login-input::placeholder {
  color: #6b6b80;
}

.login-input:focus {
  outline: none;
  border-color: #4AA8D8;
  box-shadow: 0 0 0 3px rgba(74, 168, 216, 0.2);
}

.login-btn {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #4AA8D8 0%, #3B9AC9 100%);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 0.5rem;
}

.login-btn:hover {
  background: linear-gradient(135deg, #5BB9E9 0%, #4AA8D8 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(74, 168, 216, 0.3);
}

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

.remember-me-group {
  margin: 1rem 0;
}

.remember-me-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.remember-me-checkbox {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.remember-me-checkmark {
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  margin-right: 10px;
  position: relative;
  transition: all 0.2s ease;
}

.remember-me-checkbox:checked + .remember-me-checkmark {
  background: #4AA8D8;
  border-color: #4AA8D8;
}

.remember-me-checkmark::after {
  content: '';
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.remember-me-checkbox:checked + .remember-me-checkmark::after {
  display: block;
}

.remember-me-text {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.remember-me-label:hover .remember-me-checkmark {
  border-color: rgba(255, 255, 255, 0.5);
}

.login-error {
  color: #ef4444;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  min-height: 1.25rem;
}

.app-hidden {
  display: none !important;
}

/* All Systems Overview Page */
.overview-container {
  padding: 0;
}

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

.overview-last-updated {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Fit to Screen Button */
/* Fit to Screen button icon toggle */
#fitScreenBtn .exit-fit-icon {
  display: none;
}

body.fit-mode #fitScreenBtn .fit-icon {
  display: none;
}

body.fit-mode #fitScreenBtn .exit-fit-icon {
  display: block;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.overview-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition);
}

.overview-tile:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

.overview-tile-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.overview-tile-header:hover {
  background: var(--bg-hover);
}

.overview-tile-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: white;
  padding: 3px;
  border-radius: 6px;
  flex-shrink: 0;
}

.overview-tile-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.overview-tile-body {
  padding: 1rem 1.25rem;
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.overview-stat {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  background: var(--bg-primary);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

.overview-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.overview-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.overview-stat.created .overview-stat-value {
  color: var(--info);
}

.overview-stat.done .overview-stat-value {
  color: var(--success);
}

.overview-stat.open .overview-stat-value {
  color: var(--warning);
}

.overview-stat.missed .overview-stat-value {
  color: var(--error);
}

.overview-chart-container {
  height: 150px;
  position: relative;
  margin-top: 0.5rem;
}

.overview-tile-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-muted);
}

.overview-tile-loading .loading-spinner {
  width: 30px;
  height: 30px;
  margin-bottom: 0.5rem;
}

/* Overview nav item styling */
.overview-nav {
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem !important;
}

/* Responsive adjustments for overview */
@media (max-width: 1400px) {
  .overview-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

@media (max-width: 768px) {
  .overview-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .overview-stat-value {
    font-size: 1.25rem;
  }

  .overview-chart-container {
    height: 120px;
  }
}

/* ==================== */
/* FIT TO SCREEN MODE   */
/* ==================== */
body.fit-mode {
  overflow: hidden;
}

body.fit-mode .sidebar {
  display: none !important;
}

body.fit-mode .header {
  left: 0; /* Expand to full width when sidebar is hidden */
}

body.fit-mode .exclusion-note {
  left: 0;
}

body.fit-mode .main-content {
  margin-left: 0;
  height: 100vh;
  overflow: hidden;
}

body.fit-mode #page-overview {
  padding: 0.5rem;
  padding-top: calc(70px + 0.5rem); /* Account for fixed header */
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

body.fit-mode .overview-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.fit-mode .overview-header {
  margin-bottom: 0.25rem;
  flex-shrink: 0;
}

body.fit-mode .overview-last-updated {
  font-size: 0.75rem;
}

body.fit-mode .overview-grid {
  flex: 1;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  align-content: stretch;
  min-height: 0;
}

body.fit-mode .overview-tile {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.fit-mode .overview-tile-header {
  padding: 0.4rem 0.6rem;
  gap: 0.4rem;
}

body.fit-mode .overview-tile-logo {
  width: 24px;
  height: 24px;
  padding: 2px;
}

body.fit-mode .overview-tile-name {
  font-size: 0.85rem;
}

body.fit-mode .overview-tile-body {
  padding: 0.4rem 0.6rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.fit-mode .overview-tile-content {
  display: flex !important;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

body.fit-mode .overview-stats {
  gap: 0.3rem;
  margin-bottom: 0.4rem;
  flex-shrink: 0;
  pointer-events: none; /* Allow clicks to pass through to tile for navigation */
}

body.fit-mode .overview-stat {
  padding: 0.3rem 0.4rem;
}

body.fit-mode .overview-stat-value {
  font-size: 1rem;
  line-height: 1.1;
}

body.fit-mode .overview-stat-label {
  font-size: 0.6rem;
  margin-top: 0.1rem;
}

body.fit-mode .overview-chart-container {
  flex: 1;
  min-height: 60px;
  height: auto;
  margin-top: 0.2rem;
  pointer-events: none; /* Allow clicks to pass through to tile for navigation */
}

/* Adjustments for different screen sizes in fit mode */
@media (max-width: 1600px) {
  body.fit-mode .overview-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 1200px) {
  body.fit-mode .overview-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  body.fit-mode .overview-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Light theme login adjustments */
[data-theme="light"] .login-screen {
  background: linear-gradient(135deg, #e8eef5 0%, #dce4ed 50%, #cfd9e5 100%);
}

[data-theme="light"] .login-container {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .login-title {
  color: #1a1a2e;
}

[data-theme="light"] .login-input {
  background: rgba(248, 250, 252, 1);
  border-color: rgba(0, 0, 0, 0.1);
  color: #1a1a2e;
}

[data-theme="light"] .login-input::placeholder {
  color: #9ca3af;
}

[data-theme="light"] .remember-me-checkmark {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .remember-me-text {
  color: rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .remember-me-label:hover .remember-me-checkmark {
  border-color: rgba(0, 0, 0, 0.4);
}

/* Shake animation for login error */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Professional Background */
.login-bg-gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(74, 168, 216, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 10%, rgba(16, 185, 129, 0.08) 0%, transparent 40%);
  animation: gradientShift 15s ease-in-out infinite;
}

.login-bg-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 0%, 100% 100%, 50% 0%;
  }
  50% {
    background-position: 100% 100%, 0% 0%, 50% 100%;
  }
}

.login-container {
  position: relative;
  z-index: 1;
}

/* Light theme background */
[data-theme="light"] .login-bg-gradient {
  background:
    radial-gradient(ellipse at 20% 20%, rgba(74, 168, 216, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 10%, rgba(16, 185, 129, 0.1) 0%, transparent 40%);
}

[data-theme="light"] .login-bg-gradient::before {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}
