:root {
  --bg-color: #050505;
  --card-bg: #0A0A0A;
  --sidebar-bg: #F7D000;
  /* Yellow Sidebar */
  --text-color: #E0E0E0;
  --text-muted: #666666;
  --text-on-yellow: #000000;
  --accent-color: #F7D000;
  --accent-dim: rgba(247, 208, 0, 0.1);
  --border-color: #1A1A1A;
  --sidebar-border: rgba(0, 0, 0, 0.1);
  --success-color: #00F7A0;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body,
html {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-main);
  font-size: 16px;
  overflow-x: hidden;
}

/* Typography Tools */
h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  color: #fff;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.hidden {
  display: none !important;
}

/* Layout Structure */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  /* For mobile menu positioning */
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  background-color: var(--sidebar-bg);
  border-right: none;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 1000;
  color: var(--text-on-yellow);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease, padding 0.3s ease;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  /* Strong pop-out shadow */
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 900;
  color: #000;
  letter-spacing: -0.05em;
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo span {
  color: #fff;
  /* White accent on yellow */
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  color: #000;
  /* Black text on yellow */
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  gap: 0.75rem;
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #000;
  opacity: 1;
  transform: translateX(4px);
}

.nav-item.active {
  background: #000;
  color: var(--accent-color) !important;
  /* Yellow text on black */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-weight: 700;
  opacity: 1;
}

.nav-item.active:hover {
  transform: none;
  /* No movement for active item */
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding-top: 1.5rem;
}

/* Collapse Button (Desktop) */
.collapse-btn {
  position: absolute;
  top: 1.5rem;
  right: -12px;
  width: 24px;
  height: 24px;
  background: #000;
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1001;
  transition: all 0.2s ease;
  opacity: 0;
  /* Hidden by default, shown on hover/collapsed */
}

.sidebar:hover .collapse-btn,
.sidebar.collapsed .collapse-btn {
  opacity: 1;
}

.sidebar.collapsed .collapse-btn svg {
  transform: rotate(180deg);
}

/* Collapsed Sidebar State */
.sidebar.collapsed {
  width: 80px;
  padding: 2rem 1rem;
}

.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-logo {
  display: none;
}

.sidebar.collapsed .sidebar-logo::after {
  content: "P.";
  font-size: 1.5rem;
  font-weight: 800;
  color: #000;
  display: block;
  text-align: center;
  width: 100%;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 1rem;
}

.sidebar.collapsed .nav-item svg {
  margin: 0;
}

/* Mobile Toggle */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 2000;
  background: var(--accent-color);
  border: none;
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mobile-menu-toggle svg {
  width: 24px;
  height: 24px;
  fill: #000;
}

/* Main Content Area */
.main-scroll-area {
  flex: 1;
  padding: 2.5rem 3rem;
  background: var(--bg-color);
  overflow-y: auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Center horizontally */
}

.dashboard-header,
.dashboard-grid,
footer {
  width: 100%;
  max-width: 1200px;
  /* Constrain width for centering */
}

/* Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 3rem;
}

.greeting {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #fff;
  /* White instead of muted */
  opacity: 0.9;
  /* More visible */
  margin-bottom: 0.5rem;
}

#user-name {
  color: #fff;
  font-weight: 700;
}

h2 {
  font-size: 2rem;
  letter-spacing: -0.03em;
}

/* Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  /* 12-column grid for flexibility */
  gap: 1.5rem;
  width: 100%;
  max-width: 1400px;
}

/* Card Styling */
.dashboard-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.75rem;
  position: relative;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Hover effects for clickable cards */
.dashboard-card[onclick]:hover {
  border-color: var(--accent-color);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
  transform: translateY(-4px);
}

.dashboard-card[onclick]::after {
  content: "↗";
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  color: var(--text-muted);
  opacity: 0;
  transition: all 0.2s ease;
  font-size: 1.2rem;
}

.dashboard-card[onclick]:hover::after {
  opacity: 1;
  color: var(--accent-color);
}


/* Sizing Helpers */
.wide-card {
  grid-column: span 12;
}

.medium-card {
  grid-column: span 6;
}

.small-card {
  grid-column: span 4;
}

/* Responsive Grid overrides */
@media (min-width: 1024px) {
  .wide-card {
    grid-column: span 8;
  }

  .dashboard-card:nth-child(2) {
    grid-column: span 4;
  }

  /* App Usage */
  .small-card {
    grid-column: span 4;
  }

  /* Coffee + Presence */
  .dashboard-card:last-child {
    grid-column: span 12;
  }

  /* Recent Activity */
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -290px;
    height: 100vh;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  .sidebar.active {
    transform: translateX(290px);
  }

  .collapse-btn {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .main-scroll-area {
    padding: 1.5rem;
    padding-top: 4rem;
    /* Space for toggle */
    height: auto;
    overflow: visible;
  }

  .dashboard-grid {
    display: flex;
    flex-direction: column;
  }
}


/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.card-header h3 {
  font-size: 1rem;
  color: #fff;
  font-weight: 600;
  /* Bolder */
  opacity: 1;
  /* Ensure no opacity */
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  /* Slight lift */
}

.badge {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 500;
}

/* Content Elements */
.stat-value {
  font-size: 3rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.stat-unit {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  /* Less opaque */
  font-weight: 400;
}

.presence-status {
  margin-bottom: 1rem;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.status-indicator::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

/* Status Colors */
#presence-val.status-present {
  color: var(--success-color);
}

#presence-val.status-away {
  color: var(--accent-color);
}

#presence-val.status-offline {
  color: var(--text-muted);
}


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

/* Charts */
.chart-container {
  position: relative;
  width: 100%;
  height: 240px;
  /* Reduced specific height for better scaling */
  flex: 1;
}

.mini-chart {
  height: 100px;
  width: 100%;
  margin-top: auto;
}

/* Tables */
.activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.activity-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.activity-table td {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: #eee;
}

.activity-table tr:last-child td {
  border-bottom: none;
}

/* Footer */
footer {
  margin-top: 4rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  opacity: 0.5;
}

/* Auth Page specific overrides if needed */
.auth-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem;
  background: var(--bg-color);
}