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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 16px;
  background: #fafafa;
  color: #212121;
}

#app {
  max-width: 480px;
  margin: 0 auto;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-nav h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.cal-nav button {
  background: none;
  border: 1px solid #bdbdbd;
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.cal-nav button:hover { background: #f0f0f0; }

.cal-headers,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-headers { margin-bottom: 4px; }

.cal-header-cell {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 0;
  color: #757575;
}

.cal-cell {
  min-height: 48px;
  border-radius: 6px;
  position: relative;
  cursor: pointer;
  background: transparent;
}

.cal-cell:hover { opacity: 0.85; }

.cal-cell__num {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #333;
  pointer-events: none;
}

.cal-cell[data-status="in-office"]  { background: #4CAF50; }
.cal-cell[data-status="at-home"]    { background: #2196F3; }
.cal-cell[data-status="time-off"]   { background: #9E9E9E; }
.cal-cell[data-status="wfa"]        { background: #FF9800; }
.cal-cell[data-status="unset"]      { background: transparent; border: 1px solid #e0e0e0; }

.cal-cell--today {
  outline: 2px solid #1565C0;
  outline-offset: -2px;
}

.cal-cell--empty {
  background: transparent;
  cursor: default;
  border: none;
  pointer-events: none;
}

.cal-cell[data-disabled="true"] {
  opacity: 0.3;
  pointer-events: none;
  cursor: default;
  background: transparent !important;
}

.cal-cell:focus {
  outline: 2px solid #1565C0;
  outline-offset: -2px;
  z-index: 1;
}
.cal-cell:focus:not(:focus-visible) {
  outline: none;
}

.brush-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  justify-content: center;
}

.brush-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #f0f0f0;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.brush-btn:hover { background: #e0e0e0; }

.brush-btn--active {
  border-color: #212121;
  background: #e8e8e8;
  font-weight: 600;
}

.brush-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.brush-swatch[data-status="in-office"]  { background: #4CAF50; }
.brush-swatch[data-status="at-home"]    { background: #2196F3; }
.brush-swatch[data-status="time-off"]   { background: #9E9E9E; }
.brush-swatch[data-status="wfa"]        { background: #FF9800; }

/* Stats panel */
#stats {
  margin-top: 16px;
  text-align: center;
}

.stats-average {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: #212121;
}

.stats-totals {
  font-size: 0.85rem;
  color: #555;
  margin: 0;
}

.stat-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 2px;
}

.stat-dot[data-status="in-office"]  { background: #4CAF50; }
.stat-dot[data-status="at-home"]    { background: #2196F3; }
.stat-dot[data-status="time-off"]   { background: #9E9E9E; }
.stat-dot[data-status="wfa"]        { background: #FF9800; }

/* Preferences panel (weekend toggle) */
.cal-preferences {
  margin-top: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: #555;
}
.cal-preferences label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cal-preferences input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

@media (max-width: 480px) {
  body { padding: 8px; }
  .cal-cell { min-height: 40px; }
  .cal-cell__num { font-size: 0.7rem; }
  .stats-average { font-size: 1.25rem; }
  .stats-totals { font-size: 0.75rem; }
}

@media (prefers-color-scheme: dark) {
  body {
    background: #121212;
    color: #e0e0e0;
  }

  .cal-nav button {
    border-color: #424242;
    color: #e0e0e0;
  }
  .cal-nav button:hover {
    background: #1e1e1e;
  }

  .cal-header-cell {
    color: #9e9e9e;
  }

  .cal-cell__num {
    color: #e0e0e0;
  }

  .cal-cell[data-status="unset"] {
    border-color: #424242;
  }
  .cal-cell[data-status="in-office"]  { background: #388E3C; }
  .cal-cell[data-status="at-home"]    { background: #64B5F6; color: #121212; }
  .cal-cell[data-status="time-off"]   { background: #757575; }
  .cal-cell[data-status="wfa"]        { background: #FFB74D; color: #121212; }

  .cal-cell--today {
    outline-color: #42A5F5;
  }

  .cal-cell:focus {
    outline-color: #42A5F5;
  }

  .brush-btn {
    background: #1e1e1e;
    color: #e0e0e0;
  }
  .brush-btn:hover { background: #2a2a2a; }
  .brush-btn--active {
    border-color: #e0e0e0;
    background: #2a2a2a;
  }

  .brush-swatch[data-status="in-office"]  { background: #388E3C; }
  .brush-swatch[data-status="at-home"]    { background: #64B5F6; }
  .brush-swatch[data-status="time-off"]   { background: #757575; }
  .brush-swatch[data-status="wfa"]        { background: #FFB74D; }

  .stat-dot[data-status="in-office"]  { background: #388E3C; }
  .stat-dot[data-status="at-home"]    { background: #64B5F6; }
  .stat-dot[data-status="time-off"]   { background: #757575; }
  .stat-dot[data-status="wfa"]        { background: #FFB74D; }

  .stats-average {
    color: #e0e0e0;
  }
  .stats-totals {
    color: #bdbdbd;
  }


  .cal-preferences {
    color: #bdbdbd;
  }
}
