body {
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: background var(--transition-normal), color var(--transition-normal);
}

/* Top bar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  z-index: 100;
  gap: var(--space-md);
}

.topbar__brand {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.topbar__nav {
  display: flex;
  gap: var(--space-xs);
  margin-left: var(--space-lg);
}

.topbar__link {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.topbar__link:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.topbar__link--active {
  color: var(--accent);
  background: var(--bg-surface);
}

.topbar__spacer {
  flex: 1;
}

.topbar__sync {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

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

.topbar__sync-dot--synced {
  background: var(--success);
}

.topbar__sync-dot--syncing {
  background: var(--warning);
  animation: pulse 1s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

/* Main content */
.main {
  margin-top: var(--topbar-height);
  padding: var(--space-xl);
  max-width: var(--max-content-width);
  margin-left: auto;
  margin-right: auto;
}

.main__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.main__title {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

/* Card base */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-md);
}

/* Section */
.section {
  margin-bottom: var(--space-xl);
}

.section__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
  .topbar__nav {
    display: none;
  }

  .main {
    padding: var(--space-md);
  }

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

@media (min-width: 769px) and (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* Mobile nav toggle */
.topbar__menu-btn {
  display: none;
  padding: var(--space-xs);
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .topbar__menu-btn {
    display: flex;
  }
}

.mobile-nav {
  display: none;
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-md);
  z-index: 99;
  flex-direction: column;
  gap: var(--space-xs);
}

.mobile-nav--open {
  display: flex;
}

.mobile-nav__link {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.mobile-nav__link:hover,
.mobile-nav__link--active {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.mobile-nav__divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-xs) 0;
}

/* Timer drawer toggle button */
.topbar__timer-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xs);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

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

.topbar__timer-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  color: var(--bg-primary);
  background: var(--accent);
  border-radius: var(--radius-full);
}

/* Timer drawer overlay */
.timer-drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 149;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.timer-drawer-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

/* Timer drawer panel */
.timer-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  z-index: 150;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.timer-drawer--open {
  transform: translateX(0);
}

.timer-drawer__header {
  padding: var(--space-lg);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.timer-drawer__list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

.timer-drawer__empty {
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.timer-drawer__item {
  display: block;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.timer-drawer__item:hover {
  background: var(--bg-surface);
}

.timer-drawer__item+.timer-drawer__item {
  margin-top: var(--space-xs);
}

.timer-drawer__step-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-drawer__task-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-drawer__countdown {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.03em;
}

.timer-drawer__countdown--done {
  color: var(--success);
}

/* Today Section */
.today-section {
  margin-bottom: var(--space-xl);
}

.today-section__title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.today-section__icon {
  font-size: 1.25rem;
}

.today-section__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: var(--radius-full);
}

.today-section__drop-zone {
  position: relative;
  min-height: 120px;
  padding: var(--space-md);
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--accent) 8%, var(--bg-surface)) 0%,
      var(--bg-surface) 100%);
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.today-section__drop-zone--dragover {
  border-color: var(--accent);
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--accent) 15%, var(--bg-surface)) 0%,
      color-mix(in srgb, var(--accent) 5%, var(--bg-surface)) 100%);
}

.today-section__hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  pointer-events: none;
}

.today-section__grid {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.today-section__grid .rock-card {
  flex: 0 0 auto;
  width: 200px;
}

/* Quarry Section */
.quarry-section {
  margin-top: var(--space-xl);
}

.section__subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-lg);
}

/* Rock Card Enhancements */
.rock-card {
  position: relative;
  cursor: pointer;
}

.rock-card--dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.rock-card--in-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.rock-card__remove {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.rock-card:hover .rock-card__remove {
  opacity: 1;
}

.rock-card__remove:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* Stockpile Completed Card */
.rock-card--completed {
  opacity: 0.85;
}

.rock-card--completed:hover {
  opacity: 1;
}

.rock-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  margin-top: var(--space-xs);
}

.rock-card__badge--complete {
  background: color-mix(in srgb, var(--success) 15%, var(--bg-surface));
  color: var(--success);
}

.rock-card__date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}