.rr-page {
  flex: 1 0 100%;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  background: #f4f7fb;
  color: #172033;
}

.rr-shell {
  width: min(1680px, calc(100vw - 48px));
  max-width: none;
  margin: 0 auto;
  padding: 44px 0 48px;
}

.rr-board {
  width: 100%;
  min-height: calc(100vh - 112px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.rr-header {
  display: grid;
  gap: 28px;
  align-items: end;
  padding: 18px 0 22px;
  border-bottom: 1px solid rgba(23, 32, 51, 0.12);
}

.rr-header h1 {
  margin: 0;
  color: #101827;
  font-size: 38px;
  font-weight: 850;
  line-height: 1.12;
  letter-spacing: 0;
}

.rr-header p {
  max-width: none;
  margin: 12px 0 0;
  color: #5c6878;
  font-size: 15px;
  line-height: 1.65;
  white-space: nowrap;
}

.rr-month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 210px;
  justify-content: center;
  margin: 24px auto 22px;
}

.rr-month-nav strong {
  min-width: 116px;
  text-align: center;
  color: #1f2937;
  font-size: 0.95rem;
  font-weight: 850;
}

.rr-month-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8e1ea;
  border-radius: 50%;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.rr-month-btn:hover,
.rr-month-btn:focus-visible {
  outline: none;
  border-color: #9fb4c9;
  background: #f8fafc;
}

.rr-month-btn:disabled {
  opacity: 0.36;
  cursor: not-allowed;
  box-shadow: none;
}

.rr-tabs {
  display: flex;
  align-items: center;
  gap: 64px;
  padding: 0 28px 12px;
  border-bottom: 1px solid #e6edf4;
  color: #c1c9d4;
  font-size: 0.82rem;
  font-weight: 800;
}

.rr-tabs span {
  position: relative;
  display: inline-flex;
  justify-content: center;
  min-width: 76px;
  padding: 10px 0;
}

.rr-tabs span.is-active {
  color: #315f56;
}

.rr-tabs span.is-active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 999px;
  background: #315f56;
}

.rr-content {
  padding: 0;
}

.rr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  align-content: start;
}

.rr-routine-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 218px;
  padding: 15px 15px 13px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #fdfefe;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  color: inherit;
  text-align: left;
}

.rr-routine-card:hover,
.rr-routine-card:focus-visible,
.rr-routine-card.is-active {
  outline: none;
  border-color: color-mix(in srgb, var(--routine-color, #5aa9e6) 48%, #ffffff);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.1);
}

.rr-routine-card.is-month-complete {
  border-color: #22c55e;
  background:
    linear-gradient(180deg, rgba(236, 253, 245, 0.78), rgba(255, 255, 255, 0.96) 42%),
    #ffffff;
  box-shadow: 0 12px 28px rgba(34, 197, 94, 0.14);
}

.rr-routine-card.is-month-complete:hover,
.rr-routine-card.is-month-complete:focus-visible,
.rr-routine-card.is-month-complete.is-active {
  border-color: #16a34a;
  box-shadow: 0 16px 32px rgba(34, 197, 94, 0.2);
}

.rr-card-complete-badge {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #22c55e;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 10px 22px rgba(22, 163, 74, 0.28);
  pointer-events: none;
}

.rr-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rr-card-badge {
  width: 21px;
  height: 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--routine-color, #5aa9e6);
  color: var(--routine-ink, #ffffff);
  font-size: 0.72rem;
  font-weight: 900;
}

.rr-card-title {
  min-width: 0;
  overflow: hidden;
  color: #273244;
  font-size: 0.9rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rr-card-calendar {
  display: grid;
  gap: 5px;
}

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

.rr-weekday-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 14px;
  color: #91a0ae;
  font-size: 0.56rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

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

.rr-day-cell {
  aspect-ratio: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  background: #eef3f6;
  color: #b8c4ce;
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1;
}

.rr-day-cell.is-spacer {
  background: transparent;
  box-shadow: none;
}

.rr-day-cell.is-completed {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.08)),
    color-mix(in srgb, var(--routine-color, #5aa9e6) 82%, #ffffff);
  color: var(--routine-ink, #ffffff);
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.08);
}

.rr-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 6px;
  margin-top: auto;
  color: #4b5565;
}

.rr-card-metric {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 800;
}

.rr-card-metric__label {
  max-width: 100%;
  overflow: hidden;
  color: #98a2b3;
  font-size: 0.58rem;
  font-weight: 750;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rr-card-metric strong {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
}

.rr-card-metric .rr-streak-value {
  min-width: 0;
  min-height: 28px;
}

.rr-card-metric .rr-detail-streak-badge.dv-routine-streak-badge {
  margin-left: 0;
  transform: scale(0.86);
  transform-origin: left center;
}

.rr-detail {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 2200;
  width: min(380px, calc(100vw - 48px));
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid #e4ebf2;
  border-radius: 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--routine-color, #5aa9e6) 12%, #ffffff), #ffffff 112px);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.rr-detail[hidden],
.rr-detail-backdrop[hidden] {
  display: none;
}

.rr-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2190;
  background: rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(1px);
}

.rr-detail-header {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 30px;
  gap: 12px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid #e7edf4;
}

.rr-detail-close {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d9e3ee;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #526273;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
}

.rr-detail-close:hover,
.rr-detail-close:focus-visible {
  outline: none;
  border-color: #aebdca;
  background: #ffffff;
  color: #172033;
}

.rr-detail-marker {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--routine-color, #5aa9e6);
  color: #ffffff;
  font-weight: 900;
}

.rr-detail h2 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  color: #1f2937;
  font-size: 1.12rem;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rr-detail-copy,
.rr-detail-empty p {
  margin: 0;
  color: #667085;
  font-size: 0.88rem;
  line-height: 1.55;
}

.rr-detail-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.rr-detail-stat {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid #edf2f7;
  border-radius: 7px;
  background: rgba(248, 250, 252, 0.72);
}

.rr-detail-stat span {
  color: #8a97a8;
  font-size: 0.74rem;
  font-weight: 800;
}

.rr-detail-stat strong {
  color: #263346;
  font-size: 0.98rem;
  font-weight: 900;
}

.rr-streak-value {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: fit-content;
  min-width: 26px;
  min-height: 28px;
}

.rr-detail-streak-badge.dv-routine-streak-badge {
  position: static;
  margin-left: 6px;
  pointer-events: none;
}

.rr-detail-streak-badge.dv-routine-streak-badge.is-fire,
.rr-detail-streak-badge.dv-routine-streak-badge.is-inferno {
  width: 25px;
  min-width: 25px;
  height: 28px;
  padding: 3px 0 0;
  border: 2px solid #ffffff;
  border-radius: 54% 46% 54% 46% / 70% 48% 54% 34%;
  clip-path: polygon(51% 0%, 73% 24%, 90% 50%, 84% 78%, 63% 98%, 36% 99%, 15% 80%, 8% 56%, 18% 34%, 33% 14%, 42% 24%);
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 950;
}

.rr-detail-streak-badge.dv-routine-streak-badge.is-fire {
  border: 0;
  background:
    radial-gradient(ellipse at 52% 70%, #fff36c 0 29%, #ffb000 30% 51%, transparent 52%),
    linear-gradient(150deg, #ffb000 0%, #f97316 56%, #ea580c 100%);
  box-shadow:
    0 7px 14px rgba(248, 113, 22, 0.2),
    0 0 12px rgba(251, 191, 36, 0.32);
  color: #7c2d12;
  text-shadow:
    0 1px 1px rgba(255, 247, 196, 0.86),
    0 0 1px rgba(124, 45, 18, 0.28);
}

.rr-detail-streak-badge.dv-routine-streak-badge.is-inferno {
  border: 0;
  background:
    radial-gradient(ellipse at 52% 70%, #ffe85e 0 28%, #ff9f1c 29% 49%, transparent 50%),
    linear-gradient(150deg, #ff2138 0%, #f97316 48%, #b91c1c 100%);
  box-shadow:
    0 8px 18px rgba(248, 113, 22, 0.28),
    0 0 16px rgba(239, 68, 68, 0.38);
  text-shadow: 0 1px 3px rgba(127, 29, 29, 0.85);
}

.rr-habit-stack-section {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e7edf4;
}

.rr-habit-stack-eyebrow {
  margin: 0;
}

.rr-habit-stack-list {
  gap: 8px;
}

.rr-habit-stack-item {
  cursor: default;
}

.rr-habit-stack-item:hover {
  transform: none;
}

.rr-habit-stack-title {
  display: block;
  width: auto;
  min-height: 0;
  padding: 3px 5px;
  border: 0;
  cursor: default;
}

.rr-habit-stack-list .dv-habit-stack-state button {
  cursor: pointer;
}

.rr-habit-stack-list .dv-habit-stack-state button:not(.is-active) {
  background: #eef4fb;
  border-color: #d7e2ee;
  color: #526273;
}

.rr-empty,
.rr-loading,
.rr-detail-empty {
  padding: 28px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 700;
}

.rr-detail-empty strong {
  display: block;
  margin-bottom: 8px;
  color: #243044;
}

@media (max-width: 1020px) {
  .rr-grid {
    grid-template-columns: repeat(2, minmax(190px, 1fr));
  }
}

@media (max-width: 720px) {
  .rr-shell {
    width: calc(100vw - 32px);
    padding-top: 28px;
  }

  .rr-header {
    padding-top: 10px;
  }

  .rr-header h1 {
    font-size: 30px;
  }

  .rr-header p {
    white-space: normal;
  }

  .rr-content {
    padding: 0;
  }

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

  .rr-detail {
    top: 64px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 84px);
  }
}
