.rhythm-page {
  display: grid;
  gap: 24px;
  animation: rhythm-enter 420ms var(--ease) both;
}

.nav-icon-rhythm::before {
  width: 15px;
  height: 10px;
  border-block: 2px solid currentColor;
  background: linear-gradient(90deg, transparent 0 18%, currentColor 18% 28%, transparent 28% 45%, currentColor 45% 55%, transparent 55% 72%, currentColor 72% 82%, transparent 82%);
  content: "";
}

.rhythm-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(230px, 0.5fr);
  gap: 48px;
  align-items: end;
  padding: 10px 0 26px;
  border-bottom: 1px solid var(--line);
}

.rhythm-kicker,
.rhythm-page header small,
.rhythm-rail header small,
.rhythm-agenda article small {
  margin: 0;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rhythm-hero h1 {
  max-width: 760px;
  margin: 7px 0 10px;
  font-size: clamp(28px, 3.4vw, 48px);
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.rhythm-hero p:not(.rhythm-kicker),
.rhythm-management-note p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.rhythm-week {
  display: grid;
  gap: 5px;
  padding-left: 22px;
  border-left: 2px solid var(--accent-dark);
}

.rhythm-week strong {
  font-family: "Geist Mono", monospace;
  font-size: 20px;
}

.rhythm-week span {
  color: var(--muted);
  font-size: 13px;
}

.rhythm-workspace {
  display: grid;
  grid-template-columns: minmax(230px, 0.56fr) minmax(0, 1.44fr);
  gap: 18px;
  min-width: 0;
  align-items: start;
}

.rhythm-rail,
.rhythm-stage,
.rhythm-form,
.rhythm-summary,
.rhythm-history {
  min-width: 0;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 95%, transparent);
}

.rhythm-rail {
  padding: 18px;
  position: sticky;
  top: 18px;
}

.rhythm-rail > header,
.rhythm-summary > header,
.rhythm-form > header,
.rhythm-check-in > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.rhythm-rail h2,
.rhythm-summary h2,
.rhythm-form h2,
.rhythm-history h2,
.rhythm-check-in h2,
.rhythm-management-note h2 {
  margin: 4px 0 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.rhythm-cadence-list {
  display: grid;
  margin-top: 12px;
}

.rhythm-cadence-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 76px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 12px 8px;
  text-align: left;
  transition: transform 220ms var(--ease), background 220ms var(--ease);
}

.rhythm-cadence-row:hover,
.rhythm-cadence-row.is-selected {
  background: var(--subtle);
  transform: translateX(2px);
}

.rhythm-cadence-row:active,
.rhythm-page .btn:active {
  transform: translateY(1px) scale(0.99);
}

.rhythm-cadence-row span,
.rhythm-cadence-row strong,
.rhythm-cadence-row small {
  display: block;
  min-width: 0;
}

.rhythm-cadence-row small {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.rhythm-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.rhythm-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.rhythm-status.submitted {
  color: var(--accent-dark);
}

.rhythm-status.overdue,
.rhythm-status.due {
  color: var(--danger);
}

.rhythm-status.draft {
  color: var(--warning, #9a6b18);
}

.rhythm-status.large {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid currentColor;
}

.rhythm-stage {
  display: grid;
  background: color-mix(in srgb, var(--surface) 70%, var(--panel));
}

.rhythm-check-in,
.rhythm-summary,
.rhythm-history,
.rhythm-management-note {
  padding: 24px;
}

.rhythm-check-in > header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.rhythm-prompt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 22px;
}

.rhythm-check-in label,
.rhythm-form label {
  display: grid;
  gap: 7px;
}

.rhythm-check-in label > span,
.rhythm-form label > span {
  font-size: 12px;
  font-weight: 750;
}

.rhythm-check-in textarea {
  min-height: 132px;
  resize: vertical;
}

.rhythm-check-in textarea,
.rhythm-check-in select,
.rhythm-form input,
.rhythm-form select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  padding: 11px 12px;
  font: inherit;
}

.rhythm-check-in textarea:focus,
.rhythm-check-in select:focus,
.rhythm-form input:focus,
.rhythm-form select:focus {
  border-color: var(--accent-dark);
  outline: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  outline-offset: 1px;
}

.rhythm-goals {
  margin-top: 18px;
}

.rhythm-goals select,
.rhythm-form select[multiple] {
  min-height: 116px;
}

.rhythm-goals small,
.rhythm-form label small {
  color: var(--muted);
  line-height: 1.5;
}

.rhythm-submit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.rhythm-submit-bar p {
  max-width: 52ch;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.rhythm-submit-bar > div {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.rhythm-summary,
.rhythm-history {
  border-width: 1px 0 0;
}

.rhythm-metrics {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  margin-top: 20px;
  border-block: 1px solid var(--line);
}

.rhythm-metrics > div {
  display: grid;
  gap: 6px;
  padding: 18px 18px 18px 0;
}

.rhythm-metrics > div + div {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.rhythm-metrics small {
  color: var(--muted);
}

.rhythm-metrics strong {
  font-family: "Geist Mono", monospace;
  font-size: 28px;
}

.rhythm-metrics strong span {
  margin-left: 3px;
  color: var(--muted);
  font-size: 12px;
}

.rhythm-summary-grid {
  display: grid;
  grid-template-columns: minmax(210px, 0.75fr) minmax(0, 1.25fr);
  gap: 28px;
  margin-top: 24px;
}

.rhythm-roster h3,
.rhythm-agenda h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.rhythm-roster > div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 60px;
  border-top: 1px solid var(--line);
}

.rhythm-roster strong,
.rhythm-roster small {
  display: block;
}

.rhythm-roster small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.rhythm-person-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--subtle);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.rhythm-agenda {
  min-width: 0;
}

.rhythm-agenda article {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.rhythm-agenda article > span {
  font-family: "Geist Mono", monospace;
  color: var(--muted);
  font-size: 12px;
}

.rhythm-agenda article strong {
  display: block;
  margin-top: 3px;
}

.rhythm-agenda article p,
.rhythm-clear p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.rhythm-clear {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.rhythm-history > header {
  margin-bottom: 10px;
}

.rhythm-history details {
  border-top: 1px solid var(--line);
}

.rhythm-history summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 54px;
  cursor: pointer;
}

.rhythm-history details > div {
  padding: 4px 0 16px;
}

.rhythm-history details p {
  margin: 5px 0 14px;
  color: var(--muted);
  line-height: 1.6;
}

.rhythm-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 22px;
}

.rhythm-form > header,
.rhythm-form .wide {
  grid-column: 1 / -1;
}

.rhythm-switch {
  display: flex !important;
  min-height: 44px;
  align-items: center;
  grid-template-columns: auto 1fr;
}

.rhythm-switch input {
  width: 18px;
  min-height: 18px;
}

.rhythm-form-error {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 12px;
}

.rhythm-error,
.rhythm-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 144px;
  border: 1px solid var(--line);
  padding: 24px;
}

.rhythm-error p,
.rhythm-empty p {
  max-width: 58ch;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.rhythm-empty {
  display: grid;
  justify-items: start;
}

.rhythm-empty-mark {
  width: 42px;
  height: 22px;
  border-block: 2px solid var(--accent-dark);
  background: linear-gradient(90deg, transparent 0 18%, var(--accent-dark) 18% 24%, transparent 24% 46%, var(--accent-dark) 46% 52%, transparent 52% 74%, var(--accent-dark) 74% 80%, transparent 80%);
}

.rhythm-skeleton {
  display: grid;
  grid-template-columns: 0.55fr 1.45fr;
  gap: 18px;
}

.rhythm-skeleton span {
  min-height: 160px;
  background: linear-gradient(90deg, var(--subtle), color-mix(in srgb, var(--panel) 65%, var(--subtle)), var(--subtle));
  background-size: 200% 100%;
  animation: rhythm-shimmer 1.3s ease-in-out infinite;
}

.rhythm-skeleton span:nth-child(1),
.rhythm-skeleton span:nth-child(3) {
  min-height: 90px;
}

@keyframes rhythm-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rhythm-shimmer {
  to { background-position: -200% 0; }
}

@media (max-width: 900px) {
  .rhythm-hero,
  .rhythm-workspace,
  .rhythm-summary-grid {
    grid-template-columns: 1fr;
  }

  .rhythm-week {
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .rhythm-rail {
    position: static;
  }

  .rhythm-cadence-list {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 8px;
  }

  .rhythm-cadence-row {
    border: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .rhythm-page {
    gap: 16px;
  }

  .rhythm-hero {
    gap: 22px;
  }

  .rhythm-prompt-grid,
  .rhythm-form,
  .rhythm-metrics,
  .rhythm-skeleton {
    grid-template-columns: 1fr;
  }

  .rhythm-check-in,
  .rhythm-summary,
  .rhythm-history,
  .rhythm-management-note,
  .rhythm-form,
  .rhythm-rail {
    padding: 16px;
  }

  .rhythm-check-in > header,
  .rhythm-summary > header,
  .rhythm-form > header,
  .rhythm-submit-bar,
  .rhythm-error {
    align-items: stretch;
    flex-direction: column;
  }

  .rhythm-submit-bar > div {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .rhythm-submit-bar .btn,
  .rhythm-error .btn {
    width: 100%;
    min-height: 44px;
  }

  .rhythm-metrics > div,
  .rhythm-metrics > div + div {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 12px 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .rhythm-metrics > div:first-child {
    border-top: 0;
  }

  .rhythm-form > header,
  .rhythm-form .wide {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rhythm-page,
  .rhythm-skeleton span {
    animation: none;
  }

  .rhythm-cadence-row {
    transition: none;
  }
}
