/* ── Calendar Grid ── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.cal-weekday {
  background: var(--color-surface);
  padding: 8px 4px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-day {
  background: var(--color-surface);
  min-height: 60px;
  padding: 6px 4px;
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}

.cal-day:hover { background: var(--color-primary-light); }

.cal-day.other-month {
  background: var(--color-surface2);
}

.cal-day.other-month .day-num {
  color: var(--color-border);
}

.cal-day.today {
  background: var(--color-primary-light);
}

.cal-day.today .day-num {
  background: var(--color-primary);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.cal-day.selected {
  background: var(--color-primary);
}

.cal-day.selected .day-num {
  color: white;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.day-num {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 4px;
  color: var(--color-text);
  line-height: 24px;
}

.day-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  padding: 0 2px;
}

.day-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Backdrop ── */
#panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  bottom: var(--nav-height);
  background: rgba(0, 0, 0, 0.35);
  z-index: 49;
}
#panel-backdrop.open { display: block; }

/* ── Day Detail Panel (bottom sheet) ── */
#day-panel {
  position: fixed;
  left: 0; right: 0; bottom: var(--nav-height);
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-height: 55vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0 16px 24px;
  touch-action: pan-y;
}

#day-panel.open {
  transform: translateY(0);
}

.panel-top-row {
  position: sticky;
  top: 0;
  background: var(--color-surface);
  padding: 12px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 12px;
  z-index: 1;
}

.panel-handle-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  flex-shrink: 0;
  cursor: grab;
}

.panel-handle {
  width: 36px;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
}

#day-panel .panel-date {
  font-size: 1rem;
  font-weight: 700;
  flex: 1;
}

.panel-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-surface2);
  border: none;
  font-size: 1rem;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
.panel-close-btn:hover {
  background: var(--color-border);
  color: var(--color-text);
}

/* ── Calendar container ── */
.calendar-wrap {
  padding: 0 8px 8px;
}

.calendar-header {
  padding: 8px 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
