main#main-content:has(.tmc-page) {
  --tmc-calendar-menu-gap: 4px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  overflow: hidden;
  padding: calc(var(--navbar-offset, 60px) + var(--tmc-calendar-menu-gap)) 0 0;
}

.maintenance-active main#main-content:has(.tmc-page) {
  padding-top: calc(
    var(--maintenance-banner-offset, 0px) + var(--navbar-offset, 60px) +
      var(--tmc-calendar-menu-gap)
  );
}

.tmc-page {
  background: #f5f7fb;
  color: #172033;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.tmc-page--dark,
body.dark-mode .tmc-page {
  background: #111827;
  color: #edf2f7;
}

.tmc-shell {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
  padding: 0.45rem 0.55rem 0.55rem;
  width: 100%;
}

.tmc-toolbar {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  display: grid;
  flex: 0 0 auto;
  gap: 0.65rem;
  grid-template-columns: minmax(16rem, 1fr) auto minmax(16rem, 1fr);
  padding: 0.4rem 0.55rem;
}

.tmc-page--dark .tmc-toolbar,
body.dark-mode .tmc-toolbar {
  background: #172033;
  border-color: #334155;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.tmc-disclaimer {
  align-items: center;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-left: 3px solid #f97316;
  border-radius: 8px;
  color: #7c2d12;
  display: flex;
  flex: 0 0 auto;
  font-size: 0.78rem;
  gap: 0.45rem;
  min-height: 2rem;
  padding: 0.32rem 0.6rem;
}

.tmc-disclaimer p {
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tmc-disclaimer-icon {
  align-items: center;
  background: #ffedd5;
  border-radius: 999px;
  color: #c2410c;
  display: inline-flex;
  flex: 0 0 1.35rem;
  font-size: 0.72rem;
  height: 1.35rem;
  justify-content: center;
  width: 1.35rem;
}

.tmc-page--dark .tmc-disclaimer,
body.dark-mode .tmc-disclaimer {
  background: #2b1b12;
  border-color: #7c2d12;
  color: #fed7aa;
}

.tmc-page--dark .tmc-disclaimer-icon,
body.dark-mode .tmc-disclaimer-icon {
  background: #431407;
  color: #fdba74;
}

.tmc-title-group {
  align-items: center;
  display: flex;
  gap: 0.55rem;
  min-width: 0;
}

.tmc-title-icon {
  align-items: center;
  background: #0f766e;
  border-radius: 8px;
  color: #ffffff;
  display: inline-flex;
  flex: 0 0 2rem;
  font-size: 0.9rem;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.tmc-title-group h1 {
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.05;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tmc-title-group p {
  color: #64748b;
  font-size: 0.8rem;
  line-height: 1.1;
  margin: 0.08rem 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tmc-page--dark .tmc-title-group p,
body.dark-mode .tmc-title-group p {
  color: #aebacc;
}

.tmc-team-select {
  align-items: center;
  display: flex;
  gap: 0.45rem;
  justify-self: end;
  max-width: 24rem;
  min-width: 0;
  width: min(24rem, 100%);
}

.tmc-team-select span {
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.tmc-page--dark .tmc-team-select span,
body.dark-mode .tmc-team-select span {
  color: #cbd5e1;
}

.tmc-team-select select {
  appearance: none;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #172033;
  flex: 1 1 auto;
  min-height: 2.15rem;
  min-width: 0;
  padding: 0.35rem 2rem 0.35rem 0.65rem;
}

.tmc-page--dark .tmc-team-select select,
body.dark-mode .tmc-team-select select {
  background: #0f172a;
  border-color: #475569;
  color: #f8fafc;
}

.tmc-nav-buttons {
  align-items: center;
  display: flex;
  gap: 0.35rem;
  justify-self: center;
}

.tmc-icon-btn,
.tmc-text-btn {
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #172033;
  display: inline-flex;
  font-weight: 700;
  gap: 0.4rem;
  justify-content: center;
  min-height: 2.15rem;
  padding: 0 0.65rem;
}

.tmc-icon-btn {
  aspect-ratio: 1;
  padding: 0;
  width: 2.15rem;
}

.tmc-icon-btn:hover,
.tmc-text-btn:hover {
  border-color: #0f766e;
  color: #0f766e;
}

.tmc-page--dark .tmc-icon-btn,
.tmc-page--dark .tmc-text-btn,
body.dark-mode .tmc-icon-btn,
body.dark-mode .tmc-text-btn {
  background: #0f172a;
  border-color: #475569;
  color: #f8fafc;
}

.tmc-calendar-scroll {
  background: #ffffff;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.tmc-page--dark .tmc-calendar-scroll,
body.dark-mode .tmc-calendar-scroll {
  background: #172033;
  border-color: #334155;
}

.tmc-months {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.35rem;
}

.tmc-month {
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

.tmc-page--dark .tmc-month,
body.dark-mode .tmc-month {
  border-color: #334155;
}

.tmc-month-header {
  align-items: center;
  background: #0869a6;
  color: #ffffff;
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-start;
  min-height: 2rem;
  padding: 0.38rem 0.7rem;
}

.tmc-month-header h2 {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0;
}

.tmc-grid {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.tmc-weekdays,
.tmc-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.tmc-week {
  flex: 1 1 0;
  min-height: 0;
}

.tmc-weekday {
  background: #0f7bbd;
  border-right: 1px solid rgba(255, 255, 255, 0.26);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  padding: 0.32rem 0.35rem;
  text-align: center;
  text-transform: uppercase;
}

.tmc-weekday:last-child {
  border-right: 0;
}

.tmc-day {
  background: #ffffff;
  border-right: 1px solid #d9e2ef;
  border-top: 1px solid #d9e2ef;
  display: flex;
  min-height: 0;
  padding: 0.34rem;
}

.tmc-day:nth-child(7n) {
  border-right: 0;
}

.tmc-page--dark .tmc-day,
body.dark-mode .tmc-day {
  background: #111827;
  border-color: #334155;
}

.tmc-day--out {
  background: #f1f5f9;
}

.tmc-page--dark .tmc-day--out,
body.dark-mode .tmc-day--out {
  background: #0f172a;
}

.tmc-day--weekend.tmc-day--in {
  background: #f8fafc;
}

.tmc-page--dark .tmc-day--weekend.tmc-day--in,
body.dark-mode .tmc-day--weekend.tmc-day--in {
  background: #101827;
}

.tmc-day-inner {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  height: 100%;
  min-width: 0;
  width: 100%;
}

.tmc-day--in {
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--capacity-color) 16%, #ffffff),
      #ffffff 42%
    ),
    #ffffff;
  border-top: 4px solid var(--capacity-color);
}

.tmc-page--dark .tmc-day--in,
body.dark-mode .tmc-day--in {
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--capacity-color) 24%, #111827),
      #111827 48%
    ),
    #111827;
}

.tmc-day--today {
  outline: 2px solid #1d4ed8;
  outline-offset: -2px;
}

.tmc-day-number {
  align-items: center;
  display: flex;
  justify-content: flex-start;
}

.tmc-day-number time {
  font-size: 0.82rem;
  font-weight: 800;
}

.tmc-percent {
  color: #111827;
  font-size: clamp(1.1rem, 2.2vw, 1.75rem);
  font-weight: 850;
  line-height: 1;
}

.tmc-page--dark .tmc-percent,
body.dark-mode .tmc-percent {
  color: #f8fafc;
}

.tmc-meter {
  background: rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  height: 0.38rem;
  overflow: hidden;
}

.tmc-meter span {
  background: var(--capacity-color);
  border-radius: inherit;
  display: block;
  height: 100%;
  width: calc(var(--capacity-percent) * 1%);
}

.tmc-loading,
.tmc-empty {
  align-items: center;
  color: #64748b;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  padding: 2rem;
}

.tmc-loading {
  background: rgba(255, 255, 255, 0.74);
  inset: 0;
  position: absolute;
  z-index: 2;
}

.tmc-empty {
  background: #ffffff;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  flex: 1 1 auto;
  min-height: 0;
}

.tmc-empty i {
  color: #b91c1c;
  font-size: 1.35rem;
}

.tmc-page--dark .tmc-empty,
body.dark-mode .tmc-empty {
  background: #172033;
  border-color: #334155;
}

.tmc-spinner {
  animation: tmc-spin 0.8s linear infinite;
  border: 3px solid #cbd5e1;
  border-top-color: #0f766e;
  border-radius: 999px;
  height: 1.25rem;
  width: 1.25rem;
}

@keyframes tmc-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .tmc-toolbar {
    gap: 0.45rem;
    grid-template-areas:
      "title nav"
      "team team";
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .tmc-title-group {
    grid-area: title;
  }

  .tmc-nav-buttons {
    grid-area: nav;
    justify-self: end;
  }

  .tmc-team-select {
    grid-area: team;
    justify-self: stretch;
    max-width: none;
    width: 100%;
  }

  .tmc-calendar-scroll {
    min-height: 0;
  }

  .tmc-months {
    padding: 0.3rem;
  }

  .tmc-day {
    min-height: 0;
    padding: 0.3rem;
  }

  .tmc-weekday {
    font-size: 0.68rem;
    padding: 0.28rem 0.25rem;
  }
}

@media (max-width: 620px) {
  .tmc-shell {
    gap: 0.25rem;
    padding: 0.3rem;
  }

  .tmc-toolbar {
    grid-template-areas:
      "title"
      "nav"
      "team";
    grid-template-columns: minmax(0, 1fr);
    padding: 0.35rem;
  }

  .tmc-title-group {
    align-items: center;
  }

  .tmc-title-icon {
    flex-basis: 1.75rem;
    height: 1.75rem;
    width: 1.75rem;
  }

  .tmc-nav-buttons {
    justify-content: center;
    justify-self: stretch;
    width: 100%;
  }

  .tmc-team-select {
    width: 100%;
  }

  .tmc-disclaimer {
    font-size: 0.72rem;
    min-height: 1.75rem;
    padding: 0.25rem 0.45rem;
  }

  .tmc-month-header {
    min-height: 1.7rem;
    padding: 0.28rem 0.5rem;
  }

  .tmc-month-header h2 {
    font-size: 0.8rem;
  }

  .tmc-day {
    min-height: 0;
    padding: 0.22rem;
  }

  .tmc-percent {
    font-size: 1rem;
  }

  .tmc-meter {
    height: 0.3rem;
  }
}
