.rm-app {
  --rm-bg: #10171c;
  --rm-surface: #172127;
  --rm-surface-2: #1d2a31;
  --rm-line: #34444b;
  --rm-line-soft: #26363d;
  --rm-text: #eef2ef;
  --rm-muted: #9aabb0;
  --rm-rust: #e56a2e;
  --rm-gold: #efb83f;
  --rm-teal: #4fc0bd;
  --rm-green: #67b47c;
  width: 100vw;
  min-width: 320px;
  margin: 0 calc(50% - 50vw);
  background: var(--rm-bg);
  color: var(--rm-text);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.rm-app *,
.rm-app *::before,
.rm-app *::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

.rm-app h1,
.rm-app h2,
.rm-app h3,
.rm-app p,
.rm-app dl {
  margin-top: 0;
}

.rm-masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 138px;
  padding: 26px max(24px, calc((100vw - 1440px) / 2));
  border-top: 4px solid var(--rm-rust);
  border-bottom: 1px solid var(--rm-line);
  background: #131c21;
}

.rm-masthead h1 {
  margin-bottom: 5px;
  color: var(--rm-text);
  font-size: 38px;
  line-height: 1.05;
}

.rm-subtitle {
  margin-bottom: 0;
  color: var(--rm-muted);
  font-size: 14px;
}

.rm-eyebrow {
  margin-bottom: 7px;
  color: var(--rm-gold);
  font: 700 10px/1.3 ui-monospace, "Consolas", monospace;
  text-transform: uppercase;
}

.rm-live-state {
  display: grid;
  grid-template-columns: 10px auto;
  gap: 2px 9px;
  align-items: center;
  min-width: 190px;
  color: var(--rm-muted);
  font: 700 11px/1.4 ui-monospace, "Consolas", monospace;
  text-transform: uppercase;
}

.rm-live-state time {
  grid-column: 2;
  color: #d4ddda;
  font-weight: 500;
}

.rm-live-dot {
  grid-row: 1 / 3;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--rm-gold);
}

.rm-live-state[data-state="online"] .rm-live-dot {
  background: var(--rm-green);
  box-shadow: 0 0 0 4px rgba(103, 180, 124, 0.12);
}

.rm-live-state[data-state="error"] .rm-live-dot {
  background: #e15b64;
}

.rm-channel-tabs {
  display: flex;
  gap: 0;
  padding-inline: max(24px, calc((100vw - 1440px) / 2));
  border-bottom: 1px solid var(--rm-line);
  background: #121b20;
}

.rm-channel-tabs a {
  min-width: 178px;
  padding: 14px 18px 12px;
  border-bottom: 3px solid transparent;
  color: var(--rm-muted);
  font: 700 12px/1.2 ui-monospace, "Consolas", monospace;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
}

.rm-channel-tabs a:hover {
  color: var(--rm-text);
}

.rm-channel-tabs a.is-active {
  border-bottom-color: var(--rm-teal);
  color: var(--rm-text);
  background: rgba(79, 192, 189, 0.06);
}

.rm-overview,
.rm-detail {
  width: min(1440px, calc(100% - 48px));
  margin-inline: auto;
  padding-bottom: 60px;
}

.rm-toolbar {
  display: flex;
  align-items: end;
  gap: 20px;
  min-height: 78px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rm-line);
}

.rm-select-group {
  display: grid;
  gap: 5px;
}

.rm-select-group label {
  color: var(--rm-muted);
  font: 700 9px ui-monospace, "Consolas", monospace;
  text-transform: uppercase;
}

.rm-app select,
.rm-app input[type="date"] {
  height: 34px;
  border: 1px solid #4b5e66;
  border-radius: 4px;
  background: var(--rm-surface);
  color: var(--rm-text);
  font: 700 12px ui-monospace, "Consolas", monospace;
}

.rm-app select {
  min-width: 110px;
  padding: 0 30px 0 10px;
}

.rm-app input[type="date"] {
  padding: 0 9px;
  color-scheme: dark;
}

.rm-metric-control {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(88px, 1fr));
  overflow: hidden;
  border: 1px solid #4b5e66;
  border-radius: 4px;
}

.rm-metric-control button {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid #4b5e66;
  background: var(--rm-surface);
  color: var(--rm-muted);
  cursor: pointer;
  font: 700 10px ui-monospace, "Consolas", monospace;
  text-transform: uppercase;
}

.rm-metric-control button:last-child {
  border-right: 0;
}

.rm-metric-control button.is-active {
  background: var(--rm-teal);
  color: #071416;
}

.rm-science-note {
  margin: 0 0 4px auto;
  color: var(--rm-muted);
  font-size: 11px;
}

.rm-year-band,
.rm-week-band,
.rm-record-band {
  padding: 26px 0 30px;
  border-bottom: 1px solid var(--rm-line);
}

.rm-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.rm-section-heading h2 {
  margin-bottom: 0;
  color: var(--rm-text);
  font-size: 21px;
  line-height: 1.15;
}

.rm-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  border: 1px solid var(--rm-line);
}

.rm-summary div {
  padding: 8px 12px;
  border-right: 1px solid var(--rm-line);
  background: var(--rm-surface);
}

.rm-summary div:last-child {
  border-right: 0;
}

.rm-summary dt {
  color: var(--rm-muted);
  font: 700 8px ui-monospace, "Consolas", monospace;
  text-transform: uppercase;
}

.rm-summary dd {
  margin: 3px 0 0;
  color: var(--rm-text);
  font: 700 14px ui-monospace, "Consolas", monospace;
}

.rm-heatmap-scroll,
.rm-week-scroll {
  max-width: 100%;
  overflow-x: auto;
  padding: 4px 0 10px;
}

.rm-year-grid {
  display: grid;
  grid-template-columns: 28px repeat(var(--rm-weeks, 53), 14px);
  grid-template-rows: 17px repeat(7, 14px);
  gap: 3px;
  width: max-content;
  min-width: 100%;
  align-items: center;
}

.rm-month-label {
  align-self: end;
  overflow: visible;
  color: var(--rm-muted);
  font: 700 8px ui-monospace, "Consolas", monospace;
  text-transform: uppercase;
  white-space: nowrap;
}

.rm-weekday-label {
  justify-self: end;
  padding-right: 4px;
  color: #71858b;
  font: 700 8px ui-monospace, "Consolas", monospace;
}

.rm-day-cell,
.rm-hour-cell,
.rm-heatmap-key i {
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  background: #1b292f;
}

.rm-day-cell {
  width: 14px;
  height: 14px;
  padding: 0;
  cursor: pointer;
}

.rm-day-cell:hover,
.rm-day-cell:focus-visible,
.rm-hour-cell:hover,
.rm-hour-cell:focus-visible {
  outline: 1px solid var(--rm-text);
  outline-offset: 1px;
}

.rm-day-cell.is-selected {
  outline: 2px solid var(--rm-gold);
  outline-offset: 1px;
}

.rm-day-cell[data-level="0"],
.rm-hour-cell[data-level="0"],
.rm-heatmap-key i[data-level="0"] {
  background: #1b292f;
}

.rm-day-cell[data-level="1"],
.rm-hour-cell[data-level="1"],
.rm-heatmap-key i[data-level="1"] {
  background: #174048;
}

.rm-day-cell[data-level="2"],
.rm-hour-cell[data-level="2"],
.rm-heatmap-key i[data-level="2"] {
  background: #1d6264;
}

.rm-day-cell[data-level="3"],
.rm-hour-cell[data-level="3"],
.rm-heatmap-key i[data-level="3"] {
  background: #318b80;
}

.rm-day-cell[data-level="4"],
.rm-hour-cell[data-level="4"],
.rm-heatmap-key i[data-level="4"] {
  background: #d19836;
}

.rm-day-cell[data-level="5"],
.rm-hour-cell[data-level="5"],
.rm-heatmap-key i[data-level="5"] {
  background: #ed6930;
}

.rm-heatmap-key {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 4px;
  margin-top: 3px;
  color: var(--rm-muted);
  font: 8px ui-monospace, "Consolas", monospace;
}

.rm-heatmap-key i {
  width: 11px;
  height: 11px;
}

.rm-month-strip {
  display: grid;
  grid-template-columns: repeat(12, minmax(72px, 1fr));
  gap: 1px;
  margin-top: 19px;
  border: 1px solid var(--rm-line);
  background: var(--rm-line);
}

.rm-month-button {
  min-width: 0;
  padding: 9px 8px;
  border: 0;
  background: var(--rm-surface);
  color: var(--rm-muted);
  cursor: pointer;
  text-align: left;
}

.rm-month-button:hover,
.rm-month-button.is-selected {
  background: var(--rm-surface-2);
  color: var(--rm-text);
}

.rm-month-button.is-selected {
  box-shadow: inset 0 -2px var(--rm-gold);
}

.rm-month-button span,
.rm-month-button strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-month-button span {
  font: 700 8px ui-monospace, "Consolas", monospace;
  text-transform: uppercase;
}

.rm-month-button strong {
  margin-top: 3px;
  color: var(--rm-text);
  font: 700 13px ui-monospace, "Consolas", monospace;
}

.rm-week-nav,
.rm-day-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rm-week-nav strong {
  min-width: 176px;
  color: var(--rm-text);
  font: 700 11px ui-monospace, "Consolas", monospace;
  text-align: center;
}

.rm-week-nav button,
.rm-day-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #4b5e66;
  border-radius: 4px;
  background: var(--rm-surface);
  color: var(--rm-text);
  cursor: pointer;
}

.rm-week-nav button:hover,
.rm-day-nav button:hover {
  border-color: var(--rm-teal);
  color: var(--rm-teal);
}

.rm-week-nav svg,
.rm-day-nav svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.rm-week-grid {
  display: grid;
  grid-template-columns: 76px repeat(24, minmax(22px, 1fr));
  grid-template-rows: 18px repeat(7, 24px);
  gap: 3px;
  min-width: 760px;
  align-items: center;
}

.rm-hour-label {
  color: #71858b;
  font: 700 8px ui-monospace, "Consolas", monospace;
  text-align: center;
}

.rm-week-date {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding-inline: 5px;
  color: var(--rm-muted);
  cursor: pointer;
  font: 700 9px ui-monospace, "Consolas", monospace;
}

.rm-week-date.is-selected {
  color: var(--rm-gold);
}

.rm-hour-cell {
  align-self: stretch;
  width: 100%;
  min-width: 18px;
  padding: 0;
  cursor: pointer;
}

.rm-hour-cell.is-selected-day {
  border-color: rgba(239, 184, 63, 0.52);
}

.rm-record-list {
  border-top: 1px solid var(--rm-line);
}

.rm-record {
  display: grid;
  grid-template-columns: 150px 172px minmax(0, 1fr) 104px;
  gap: 16px;
  align-items: center;
  min-height: 102px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rm-line-soft);
}

.rm-record-preview {
  display: block;
  width: 150px;
  height: 78px;
  border: 1px solid #31434c;
  border-radius: 3px;
  background: #061118;
  object-fit: cover;
  image-rendering: pixelated;
}

.rm-record-preview.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #71858b;
  font: 700 9px ui-monospace, "Consolas", monospace;
}

.rm-record-time time,
.rm-record-time strong {
  display: block;
}

.rm-record-time time {
  color: var(--rm-text);
  font: 700 13px ui-monospace, "Consolas", monospace;
}

.rm-record-time strong {
  margin-top: 5px;
  color: var(--rm-muted);
  font: 700 9px ui-monospace, "Consolas", monospace;
  text-transform: uppercase;
}

.rm-record-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  min-width: 0;
}

.rm-record-metrics span {
  min-width: 90px;
  color: var(--rm-muted);
  font-size: 10px;
}

.rm-record-metrics b {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--rm-text);
  font: 700 12px ui-monospace, "Consolas", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-record-messages {
  flex-basis: 100%;
}

.rm-open-record {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--rm-teal);
  border-radius: 4px;
  color: var(--rm-teal);
  font: 700 9px ui-monospace, "Consolas", monospace;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
}

.rm-open-record:hover {
  background: var(--rm-teal);
  color: #071416;
}

.rm-log-only {
  color: #71858b;
  font: 700 9px ui-monospace, "Consolas", monospace;
  text-align: center;
  text-transform: uppercase;
}

.rm-empty {
  padding: 36px 0;
  color: var(--rm-muted);
  font-size: 13px;
}

.rm-load-more {
  display: block;
  min-width: 140px;
  height: 36px;
  margin: 20px auto 0;
  border: 1px solid #4b5e66;
  border-radius: 4px;
  background: var(--rm-surface);
  color: var(--rm-text);
  cursor: pointer;
  font: 700 10px ui-monospace, "Consolas", monospace;
  text-transform: uppercase;
}

.rm-load-more:hover {
  border-color: var(--rm-teal);
}

.rm-detail {
  padding-top: 22px;
}

.rm-detail-back {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--rm-teal);
  font: 700 11px ui-monospace, "Consolas", monospace;
  text-decoration: none;
}

.rm-detail-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rm-line);
}

.rm-detail-heading h2 {
  margin-bottom: 4px;
  color: var(--rm-text);
  font-size: 24px;
}

.rm-detail-heading p {
  margin-bottom: 0;
  color: var(--rm-muted);
  font: 700 11px ui-monospace, "Consolas", monospace;
}

.rm-detail-heading dl {
  display: flex;
  gap: 1px;
  background: var(--rm-line);
  border: 1px solid var(--rm-line);
}

.rm-detail-heading dl div {
  min-width: 110px;
  padding: 8px 11px;
  background: var(--rm-surface);
}

.rm-detail-heading dt {
  color: var(--rm-muted);
  font: 700 8px ui-monospace, "Consolas", monospace;
  text-transform: uppercase;
}

.rm-detail-heading dd {
  margin: 3px 0 0;
  color: var(--rm-text);
  font: 700 12px ui-monospace, "Consolas", monospace;
}

.rm-detail-frame {
  display: block;
  width: 100%;
  height: 1100px;
  border: 0;
  background: #f4efe4;
}

.rm-tooltip {
  position: fixed;
  z-index: 99999;
  max-width: 260px;
  padding: 7px 9px;
  border: 1px solid #56676d;
  border-radius: 3px;
  background: #071116;
  color: var(--rm-text);
  pointer-events: none;
  font: 10px/1.45 ui-monospace, "Consolas", monospace;
  white-space: pre-line;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.rm-error {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99998;
  max-width: min(460px, calc(100vw - 40px));
  padding: 12px 15px;
  border: 1px solid #a33f47;
  border-radius: 4px;
  background: #3a171b;
  color: #fff0f0;
  font-size: 12px;
}

/* The parent theme styles every button with !important. Keep archive controls
   and heatmap cells isolated so their colours retain their data meaning. */
.rm-app .rm-metric-control button {
  border: 0 !important;
  border-right: 1px solid #4b5e66 !important;
  background: var(--rm-surface) !important;
  color: var(--rm-muted) !important;
}

.rm-app .rm-metric-control button:last-child {
  border-right: 0 !important;
}

.rm-app .rm-metric-control button.is-active {
  background: var(--rm-teal) !important;
  color: #071416 !important;
}

.rm-app .rm-day-cell,
.rm-app .rm-hour-cell {
  border: 1px solid rgba(255, 255, 255, 0.04) !important;
}

.rm-app .rm-day-cell[data-level="0"],
.rm-app .rm-hour-cell[data-level="0"] {
  background: #1b292f !important;
}

.rm-app .rm-day-cell[data-level="1"],
.rm-app .rm-hour-cell[data-level="1"] {
  background: #174048 !important;
}

.rm-app .rm-day-cell[data-level="2"],
.rm-app .rm-hour-cell[data-level="2"] {
  background: #1d6264 !important;
}

.rm-app .rm-day-cell[data-level="3"],
.rm-app .rm-hour-cell[data-level="3"] {
  background: #318b80 !important;
}

.rm-app .rm-day-cell[data-level="4"],
.rm-app .rm-hour-cell[data-level="4"] {
  background: #d19836 !important;
}

.rm-app .rm-day-cell[data-level="5"],
.rm-app .rm-hour-cell[data-level="5"] {
  background: #ed6930 !important;
}

.rm-app .rm-month-button {
  border: 0 !important;
  background: var(--rm-surface) !important;
  color: var(--rm-muted) !important;
}

.rm-app .rm-month-button:hover,
.rm-app .rm-month-button.is-selected {
  background: var(--rm-surface-2) !important;
  color: var(--rm-text) !important;
}

.rm-app .rm-week-nav button,
.rm-app .rm-day-nav button,
.rm-app .rm-load-more {
  border: 1px solid #4b5e66 !important;
  background: var(--rm-surface) !important;
  color: var(--rm-text) !important;
}

.rm-app .rm-week-nav button:hover,
.rm-app .rm-day-nav button:hover,
.rm-app .rm-load-more:hover {
  border-color: var(--rm-teal) !important;
  color: var(--rm-teal) !important;
}

@media (max-width: 900px) {
  .rm-masthead {
    align-items: flex-start;
    padding-inline: 20px;
  }

  .rm-overview,
  .rm-detail {
    width: calc(100% - 32px);
  }

  .rm-toolbar {
    flex-wrap: wrap;
  }

  .rm-science-note {
    flex-basis: 100%;
    margin-left: 0;
  }

  .rm-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .rm-summary {
    width: 100%;
  }

  .rm-month-strip {
    grid-template-columns: repeat(6, minmax(72px, 1fr));
  }

  .rm-record {
    grid-template-columns: 128px 150px minmax(0, 1fr);
  }

  .rm-record-preview {
    width: 128px;
    height: 72px;
  }

  .rm-open-record,
  .rm-log-only {
    grid-column: 3;
    justify-self: start;
  }

  .rm-detail-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .rm-detail-heading dl {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .rm-masthead {
    min-height: 0;
    flex-direction: column;
    gap: 18px;
  }

  .rm-masthead h1 {
    font-size: 32px;
  }

  .rm-live-state {
    width: 100%;
  }

  .rm-channel-tabs {
    padding-inline: 0;
  }

  .rm-channel-tabs a {
    flex: 1;
    min-width: 0;
    padding-inline: 8px;
  }

  .rm-overview,
  .rm-detail {
    width: calc(100% - 24px);
  }

  .rm-toolbar {
    align-items: stretch;
  }

  .rm-select-group,
  .rm-metric-control {
    flex: 1;
  }

  .rm-app select {
    width: 100%;
  }

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

  .rm-summary div {
    border-right: 0;
    border-bottom: 1px solid var(--rm-line);
  }

  .rm-summary div:last-child {
    border-bottom: 0;
  }

  .rm-month-strip {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
  }

  .rm-week-nav,
  .rm-day-nav {
    width: 100%;
  }

  .rm-week-nav strong,
  .rm-day-nav input {
    flex: 1;
  }

  .rm-record {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
  }

  .rm-record-preview {
    width: 96px;
    height: 64px;
  }

  .rm-record-metrics {
    grid-column: 1 / -1;
  }

  .rm-open-record,
  .rm-log-only {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .rm-detail-heading dl {
    flex-direction: column;
  }

  .rm-detail-heading dl div {
    border-bottom: 1px solid var(--rm-line);
  }

  .rm-detail-frame {
    height: 900px;
  }
}
