/* Calendar view: toolbar, monthly totals, month grid. Mobile-first. */

/* ---- Toolbar ---- */
.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-bottom: 0.75rem;
}

.cal-toolbar__nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cal-toolbar__title {
  margin: 0;
  font-size: 1.15rem;
  min-width: 9.5rem;
  text-align: center;
}

.cal-toolbar__picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.cal-toolbar__picker label {
  font-weight: 600;
  font-size: 0.9rem;
}

.cal-toolbar__picker select {
  width: auto;
  max-width: 14rem;
}

/* ---- Monthly totals ---- */
.cal-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.cal-totals__card {
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cal-totals__card--normal {
  background: var(--c-normal-bg);
  color: var(--c-normal-text);
  border-left: 5px solid var(--c-normal);
}

.cal-totals__card--extra {
  background: var(--c-extra-bg);
  color: var(--c-extra-text);
  border-left: 5px solid var(--c-extra);
}

.cal-totals__label {
  font-size: 0.85rem;
  font-weight: 600;
}

.cal-totals__value {
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

/* ---- Month grid ---- */
.cal {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cal__weekdays,
.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal__weekday {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--c-muted);
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--c-border);
}

.cal__day {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-height: 3.4rem;
  padding: 0.2rem;
  border: 0;
  border-top: 1px solid var(--c-border);
  border-left: 1px solid var(--c-border);
  background: var(--c-surface);
  cursor: pointer;
  text-align: left;
}

.cal__grid .cal__day:nth-child(7n + 1) {
  border-left: 0;
}

.cal__grid .cal__day:nth-child(-n + 7) {
  border-top: 0;
}

.cal__day:hover {
  background: rgb(37 99 235 / 0.06);
}

.cal__day--out {
  background: var(--c-bg);
  color: var(--c-muted);
}

.cal__day--today .cal__daynum {
  background: var(--c-primary);
  color: #fff;
}

.cal__daynum {
  align-self: flex-start;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.2rem 0.3rem;
  border-radius: 999px;
  min-width: 1.4em;
  text-align: center;
}

.cal__entries {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

/* Mobile: entries render as colored dots (details on tap). */
.cal__chip {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  overflow: hidden;
  text-indent: -999px; /* hide the time text, keep it for larger screens */
  white-space: nowrap;
}

.cal__chip--normal {
  background: var(--c-normal);
  color: var(--c-normal-text);
}

.cal__chip--extra {
  background: var(--c-extra);
  color: var(--c-extra-text);
}

@media (min-width: 640px) {
  .cal__day {
    min-height: 5.2rem;
    padding: 0.3rem;
  }

  .cal__chip {
    width: auto;
    height: auto;
    text-indent: 0;
    font-size: 0.72rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    padding: 0.1rem 0.3rem;
    border-radius: var(--radius-sm);
  }

  .cal__chip--normal {
    background: var(--c-normal-bg);
    border-left: 3px solid var(--c-normal);
  }

  .cal__chip--extra {
    background: var(--c-extra-bg);
    border-left: 3px solid var(--c-extra);
  }
}
