/* ==========================================================================
   Routine5 Theme — matches the Routine5 mobile app design system
   Load AFTER Bootstrap / style.min.css:
   <link rel="stylesheet" href="/css/routine5-theme.css">
   ========================================================================== */

:root {
  --r5-accent: #0E9AAE;
  --r5-accent-dark: #0B7A8A;
  --r5-bg: #F2F2F7;
  --r5-surface: #FFFFFF;
  --r5-text: #000000;
  --r5-subtext: #8E8E93;
  --r5-border: rgba(60, 60, 67, 0.13);
  --r5-pill: #E5E5EA;
  --r5-radius-sm: 8px;
  --r5-radius-md: 12px;
  --r5-radius-lg: 16px;
  --r5-tint-green: #D9EFE2;
  --r5-tint-red: #FBE0DB;
  --r5-tint-yellow: #FCEFD4;
  --r5-tint-blue: #E2E3F5;
  --r5-tint-sky: #DCEBF5;
  --r5-tint-purple: #EEE2F6;
}

body.stretched,
body {
  background: var(--r5-bg) !important;
  color: var(--r5-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
a { color: var(--r5-accent); text-decoration: none; }
a:hover { color: var(--r5-accent-dark); }

/* --------------------------------------------------------------------------
   Header / navbar (keeps Bootstrap collapse behaviour for mobile)
   -------------------------------------------------------------------------- */
#header, #header-wrap {
  background: rgba(242, 242, 247, 0.98) !important;
  border-bottom: 1px solid var(--r5-border);
  box-shadow: none;
}
@supports (backdrop-filter: blur(12px)) {
  #header-wrap { backdrop-filter: blur(12px); background: rgba(242, 242, 247, 0.86) !important; }
}
#header .navbar { padding: 10px 0; }
#header .navbar-brand img.logo-default { height: 44px; width: auto; }
#header .navbar-nav { gap: 4px; align-items: center; }
#header .navbar-nav .nav-link {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--r5-subtext);
  letter-spacing: 0;
  text-transform: none;
  transition: background 0.15s ease, color 0.15s ease;
}
#header .navbar-nav .nav-link:hover { background: var(--r5-pill); color: var(--r5-text); }
#header .navbar-nav .nav-item.active .nav-link,
#header .navbar-nav .nav-link.active { background: var(--r5-pill); color: var(--r5-accent); font-weight: 700; }
#header .navbar-nav .nav-item.r5-nav-cta .nav-link {
  background: var(--r5-accent);
  color: #fff;
  font-weight: 700;
  border-radius: var(--r5-radius-md);
  padding: 9px 20px;
  margin-left: 8px;
}
#header .navbar-nav .nav-item.r5-nav-cta .nav-link:hover { background: var(--r5-accent-dark); color: #fff; }
#header .navbar-toggler { border: 1px solid var(--r5-border); border-radius: var(--r5-radius-md); }

/* Mobile: collapsed menu becomes a card sheet */
@media (max-width: 991.98px) {
  #header .navbar-collapse {
    background: var(--r5-surface);
    border: 1px solid var(--r5-border);
    border-radius: var(--r5-radius-lg);
    padding: 10px;
    margin-top: 10px;
  }
  #header .navbar-nav { gap: 2px; align-items: stretch; }
  #header .navbar-nav .nav-link { border-radius: var(--r5-radius-md); }
  #header .navbar-nav .nav-item.r5-nav-cta .nav-link { margin-left: 0; text-align: center; }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.r5-hero {
  background: linear-gradient(180deg, #A8D8E4 0%, #C5E5EC 45%, var(--r5-bg) 100%);
  text-align: center;
  padding: 72px 24px 56px;
}
.r5-hero .r5-hero-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.r5-hero h1, .r5-hero h2 {
  margin: 0;
  font-size: clamp(32px, 5.5vw, 52px);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.08;
  color: var(--r5-text);
}
.r5-hero p {
  margin: 0;
  font-size: clamp(15px, 2.2vw, 18px);
  line-height: 1.5;
  color: #3A3A3C;
  max-width: 600px;
}
.r5-hero .r5-hero-eyebrow {
  color: var(--r5-accent-dark, #0d756d);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.r5-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.r5-btn-secondary { background: transparent; border: 2px solid var(--r5-accent); color: var(--r5-accent-dark, #0d756d); }
.r5-hero .r5-store-badges { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.r5-hero .r5-store-badges img { height: 48px; width: auto; border-radius: var(--r5-radius-md); }
.r5-hero .r5-hero-logo {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
}
.r5-hero .r5-hero-logo img { width: auto; height: 92px; max-width: 100%; }
@media (max-width: 575.98px) {
  .r5-hero { padding: 48px 20px 40px; }
}

/* --------------------------------------------------------------------------
   Section headings (replaces .fancy-title.title-border)
   -------------------------------------------------------------------------- */
.r5-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}
.r5-section-title h1, .r5-section-title h2, h1.r5-h2, h2.r5-h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.6px;
  line-height: 1.2;
  color: var(--r5-text);
  border: 0;
}
.r5-section-title .r5-view-all {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--r5-accent);
  text-decoration: none;
}
.r5-section-title .r5-view-all:hover { color: var(--r5-accent-dark, #0d9488); text-decoration: underline; }

.r5-how-it-works { margin-bottom: 32px; }
.r5-how-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.r5-how-grid article { padding: 20px; border: 1px solid var(--r5-border); border-radius: var(--r5-radius-lg); background: var(--r5-surface); }
.r5-how-grid strong { display: block; margin-bottom: 8px; font-size: 18px; color: var(--r5-text); }
.r5-how-grid p, .r5-catalog-intro p, .r5-article-intro > p { margin: 0; color: var(--r5-text-muted, #636366); }
.r5-catalog-intro { margin-bottom: 24px; }
.r5-catalog-intro h2 { margin-bottom: 8px; }

/* --------------------------------------------------------------------------
   Pinned / Featured article cards
   -------------------------------------------------------------------------- */
.r5-pinned-article {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 2px solid var(--r5-accent, #14b8a6);
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.12);
}
.r5-pinned-badge {
  display: inline-block;
  background: var(--r5-accent, #14b8a6);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}
.r5-read-more { font-size: 13px; font-weight: 600; color: var(--r5-accent, #14b8a6); text-decoration: none; }
.r5-read-more:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Article intro strip — placed after hero, horizontal scroll on mobile
   -------------------------------------------------------------------------- */
.r5-article-intro { margin-bottom: 24px; }
.r5-article-intro .r5-section-title { margin-bottom: 10px; }
.r5-article-scroll {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.r5-article-intro-card {
  background: var(--r5-surface);
  border: 1px solid var(--r5-border);
  border-radius: var(--r5-radius-lg);
  padding: 14px 16px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.r5-article-intro-card:hover {
  border-color: var(--r5-accent, #14b8a6);
  box-shadow: 0 2px 10px rgba(20, 184, 166, 0.15);
}
.r5-article-intro-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.r5-article-intro-card h3 {
  margin: 4px 0 6px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--r5-text);
}
.r5-article-intro-card p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--r5-subtext, #666);
}
.r5-article-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--r5-subtext, #888);
}
.r5-article-meta i { font-size: 10px; }

@media (max-width: 991.98px) {
  .r5-article-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 10px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .r5-article-intro-card {
    flex: 0 0 260px;
    scroll-snap-align: start;
  }
}

/* --------------------------------------------------------------------------
   Cards (overrides Bootstrap .card inside .r5-scope, and .r5-card directly)
   -------------------------------------------------------------------------- */
.r5-card, .r5-scope .card {
  background: var(--r5-surface);
  border: 1px solid var(--r5-border);
  border-radius: var(--r5-radius-lg);
  box-shadow: none;
  margin: 0 0 12px;
  overflow: hidden;
}
.r5-scope .card .card-header,
.r5-scope .card .card-body,
.r5-scope .card .card-footer {
  background: transparent;
  border: 0;
  padding: 8px 18px;
}
.r5-scope .card .card-header { padding-top: 16px; }
.r5-scope .card .card-footer {
  border-top: 1px solid var(--r5-border);
  padding: 10px 18px 14px;
  font-size: 12px;
  color: var(--r5-subtext);
}
.r5-scope .card .card-body { font-size: 13.5px; line-height: 1.45; color: #3A3A3C; padding-bottom: 12px; }
.r5-scope .card h2, .r5-scope .card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.3;
}
.r5-scope .card h2 a, .r5-scope .card h3 a { color: var(--r5-text); }
.r5-scope .card h2 a:hover, .r5-scope .card h3 a:hover { color: var(--r5-accent); }

/* Meta icon rows */
.r5-scope .entry-meta { margin: 6px 0 0; }
.r5-scope .entry-meta ul { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; }
.r5-scope .entry-meta ul li {
  margin: 0 !important;
  padding: 0;
  border: 0;
  font-size: 12px;
  color: var(--r5-subtext);
  font-family: inherit;
}
.r5-scope .entry-meta ul li i { color: var(--r5-subtext); font-size: 11px; }

/* Category pills inside card footers */
.r5-scope .card .card-footer a {
  display: inline-block;
  background: var(--r5-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 999px;
  margin-right: 6px;
}
.r5-scope .card .card-footer a:hover { background: var(--r5-accent-dark); color: #fff; }
.r5-scope .card .card-body a.float-end { font-size: 13px; font-weight: 600; color: var(--r5-accent); }

/* Generic pills */
.r5-pill {
  display: inline-block;
  background: var(--r5-pill);
  color: var(--r5-subtext);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
}
.r5-pill-accent { background: var(--r5-accent); color: #fff; font-weight: 700; letter-spacing: 0.4px; }

/* --------------------------------------------------------------------------
   Category tiles (pastel grid, matches app "Browse by Category")
   -------------------------------------------------------------------------- */
.r5-cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 575.98px) { .r5-cat-grid { grid-template-columns: 1fr 1fr; } }
.r5-cat-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: var(--r5-radius-lg);
  padding: 14px;
  color: var(--r5-text);
  background: var(--r5-tint-sky);
  transition: transform 0.12s ease;
}
.r5-cat-tile:hover { transform: translateY(-2px); color: var(--r5-text); }
.r5-cat-tile .r5-cat-name { font-size: 14px; font-weight: 700; line-height: 1.25; }
.r5-cat-tile .r5-cat-count, .r5-cat-tile .r5-cat-desc { font-size: 12px; color: var(--r5-subtext); }
.r5-cat-tile:nth-child(6n+1) { background: var(--r5-tint-green); }
.r5-cat-tile:nth-child(6n+2) { background: var(--r5-tint-red); }
.r5-cat-tile:nth-child(6n+3) { background: var(--r5-tint-yellow); }
.r5-cat-tile:nth-child(6n+4) { background: var(--r5-tint-blue); }
.r5-cat-tile:nth-child(6n+5) { background: var(--r5-tint-green); }
.r5-cat-tile:nth-child(6n+6) { background: var(--r5-tint-purple); }

/* Icon tile used at the left of routine rows */
.r5-icon-tile {
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: var(--r5-radius-md);
  background: var(--r5-tint-sky);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.r5-btn, .r5-scope .btn-primary {
  background: var(--r5-accent);
  border: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--r5-radius-md);
  padding: 11px 20px;
}
.r5-btn:hover, .r5-scope .btn-primary:hover { background: var(--r5-accent-dark); color: #fff; }
.r5-btn-outline {
  background: transparent;
  border: 1px solid var(--r5-border);
  color: var(--r5-accent);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--r5-radius-md);
  padding: 10px 18px;
}
.r5-btn-outline:hover { background: var(--r5-pill); }

/* Forms */
.r5-scope .form-control {
  background: var(--r5-surface);
  border: 1px solid var(--r5-border);
  border-radius: var(--r5-radius-md);
  padding: 9px 14px;
  font-size: 15px;
}
.r5-scope .form-control::placeholder { color: var(--r5-subtext); }
.r5-scope .form-control:focus {
  border-color: var(--r5-accent);
  box-shadow: 0 0 0 1.5px var(--r5-accent);
}

/* Pagination */
.r5-scope .pagination { gap: 6px; justify-content: center; }
.r5-scope .pagination .page-link,
.r5-scope .pagination a, .r5-scope .pagination strong {
  border: 1px solid var(--r5-border);
  border-radius: var(--r5-radius-sm);
  color: var(--r5-accent);
  background: var(--r5-surface);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}
.r5-scope .pagination .active .page-link, .r5-scope .pagination strong {
  background: var(--r5-accent);
  border-color: var(--r5-accent);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Content sections + footer
   -------------------------------------------------------------------------- */
#content.bg-light, #content { background: var(--r5-bg) !important; }
.r5-main { max-width: 1180px; margin: 0 auto; padding: 16px 24px 48px; }

#footer.dark, #footer {
  background: var(--r5-surface) !important;
  border-top: 1px solid var(--r5-border);
  color: var(--r5-subtext);
}
#footer #copyrights {
  background: transparent;
  color: var(--r5-subtext);
  font-size: 13px;
  padding: 32px 0;
}
#footer .copyright-links a { color: var(--r5-accent); font-weight: 600; }
#footer img { height: 44px; width: auto; border-radius: 10px; margin-left: 8px; }

#gotoTop {
  background: var(--r5-accent);
  border-radius: 999px;
  color: #fff;
}
#gotoTop:hover { background: var(--r5-accent-dark); }

/* --------------------------------------------------------------------------
   Routine detail page
   -------------------------------------------------------------------------- */
.r5-page-title, .page-title.r5-page-title {
  background: linear-gradient(180deg, #C5E5EC 0%, var(--r5-bg) 100%) !important;
  border: 0;
  padding: 28px 0 24px;
}
.r5-page-title .breadcrumb { background: transparent; margin: 0 0 12px; padding: 0; font-size: 13px; }
.r5-page-title .breadcrumb-item + .breadcrumb-item::before { color: var(--r5-subtext); }
.r5-detail-title {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.7px;
  line-height: 1.15;
  color: var(--r5-text);
}
.r5-detail-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 14px; color: var(--r5-subtext); }
.r5-detail-byline a { font-weight: 600; }
.r5-detail-byline-secondary { padding-left: 12px; border-left: 1px solid var(--r5-border); }

/* Sidebar card */
.r5-sidebar-card { padding: 18px; }
.r5-sidebar-card hr { border-color: var(--r5-border); opacity: 1; margin: 14px 0; }
.r5-sidebar-heading {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--r5-subtext);
  margin: 0 0 10px;
}
.r5-sidebar-group { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.r5-sidebar-stat { font-size: 14px; color: var(--r5-text); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.r5-sidebar-stat i { color: var(--r5-subtext); width: 16px; text-align: center; }
.r5-btn-block { display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px; }
.r5-pill-onaccent { background: rgba(255, 255, 255, 0.25); color: #fff; }
.r5-reach-summary { display: grid; gap: 8px; font-size: 13px; color: var(--r5-subtext); }
.r5-reach-summary span { display: flex; align-items: center; gap: 7px; }
.r5-reach-summary i { width: 16px; text-align: center; color: var(--r5-accent); }
.r5-reach-summary strong { color: var(--r5-text); }

/* Primary statistics mirror the mobile routine-detail hierarchy. */
.r5-detail-stat-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; border: 1px solid var(--r5-border); border-radius: var(--r5-radius-lg); background: var(--r5-surface); overflow: hidden; }
.r5-detail-stat { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; padding: 16px 12px; color: var(--r5-text); text-align: left; }
.r5-detail-stat + .r5-detail-stat { border-left: 1px solid var(--r5-border); }
.r5-detail-stat:hover { color: var(--r5-text); background: var(--r5-bg); }
.r5-detail-stat > i { flex: 0 0 auto; font-size: 18px; color: var(--r5-accent); }
.r5-detail-stat > div { min-width: 0; }
.r5-detail-stat strong { display: block; font-size: 18px; line-height: 1.15; white-space: nowrap; }
.r5-detail-stat span { display: block; margin-top: 3px; font-size: 11px; line-height: 1.2; color: var(--r5-subtext); white-space: nowrap; }

/* Tabs */
.r5-tabs.nav-tabs { border-bottom: 1px solid var(--r5-border); gap: 4px; }
.r5-tabs .nav-link {
  border: 0;
  border-radius: 999px 999px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--r5-subtext);
  padding: 10px 18px;
}
.r5-tabs .nav-link:hover { color: var(--r5-text); }
.r5-tabs .nav-link.active {
  background: transparent;
  color: var(--r5-accent);
  font-weight: 700;
  border-bottom: 2.5px solid var(--r5-accent);
}

/* Content cards in tabs */
.r5-content-card { display: block; padding: 18px 20px; color: var(--r5-text); }
.r5-version-line { font-size: 14px; margin-bottom: 4px; }
.r5-version-line i { color: var(--r5-subtext); }
.r5-meta-line { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--r5-subtext); margin-bottom: 10px; }
.r5-description { font-size: 15px; line-height: 1.55; }
.r5-h3 { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; margin: 8px 0 12px; }
.r5-empty-copy { margin: 12px 0 0; color: var(--r5-subtext); font-style: italic; }

/* Routine community */
.r5-community-section { display: block; margin-top: 32px; }
.r5-community-intro { margin: -6px 0 16px; color: var(--r5-subtext); }
.r5-community-composer { margin-bottom: 20px; border-color: rgba(15, 157, 117, 0.3); }
.r5-community-signin { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.r5-community-signin p { margin: 3px 0 0; color: var(--r5-subtext); }
.r5-community-signin .r5-btn { flex-shrink: 0; }
.r5-community-list { display: grid; gap: 12px; }
.r5-community-post { display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px; }
.r5-community-avatar { flex: 0 0 auto; }
.r5-community-post-body { flex: 1; min-width: 0; }
.r5-community-post-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.r5-community-post-title { display: block; font-size: 16px; line-height: 1.35; }
.r5-community-post-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; font-size: 12px; color: var(--r5-subtext); }
.r5-community-type { display: inline-flex; align-items: center; gap: 5px; background: var(--r5-tint-blue); color: #176A9B; white-space: nowrap; }
.r5-community-type-question { background: #FFF3D6; color: #8A5A00; }
.r5-community-type-suggestion { background: #E8E3F0; color: #6A4E93; }
.r5-community-post-copy { margin: 14px 0; font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.r5-community-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.r5-community-actions button { border: 1px solid var(--r5-border); border-radius: 999px; background: var(--r5-surface); color: var(--r5-subtext); padding: 6px 11px; font-size: 12px; font-weight: 600; }
.r5-community-actions button:hover, .r5-community-actions button.is-active { border-color: var(--r5-accent); color: var(--r5-accent); background: #E7F5F7; }
.r5-community-actions button.is-negative { border-color: #FF3B30; color: #C72C24; background: #FFF0EF; }
.r5-community-actions button span { margin-left: 3px; }
.r5-community-replies { margin-top: 16px; padding-left: 16px; border-left: 2px solid var(--r5-border); }
.r5-community-reply { padding: 10px 0; font-size: 13.5px; }
.r5-community-reply + .r5-community-reply { border-top: 1px solid var(--r5-border); }
.r5-community-reply > div { margin: 4px 0; }
.r5-community-reply small { color: var(--r5-subtext); }
.r5-community-reply-form { margin-top: 14px; padding: 14px; border-radius: var(--r5-radius-md); background: var(--r5-bg); }
.r5-empty-community { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 30px 20px; text-align: center; color: var(--r5-subtext); }
.r5-empty-community i { margin-bottom: 4px; font-size: 25px; color: var(--r5-accent); }
.r5-empty-community strong { color: var(--r5-text); }

/* Steps — numbered badges matching the app (green / orange / blue rotation) */
.r5-step { display: flex; gap: 14px; padding: 14px 0; }
.r5-step-divided { border-top: 1px solid var(--r5-border); }
.r5-step-num {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 999px;
  /* Background and label come from the view: a step is painted with its
     resolved accent (step -> routine -> category) and the label follows
     r5_accent_foreground(). These are only the fallback for a step
     rendered without one. */
  background: #64748B;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.r5-step-body { min-width: 0; flex: 1; }
.r5-step-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 15px; }
.r5-pill-duration { background: var(--r5-tint-green); color: #0C7E5E; font-weight: 700; white-space: nowrap; }
.r5-step-desc { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--r5-subtext); }

/* Version cards */
.r5-version-card { margin-bottom: 12px; transition: border-color 0.15s ease; }
.r5-version-card:hover { border-color: var(--r5-accent); color: var(--r5-text); }
.r5-version-active { border: 1.5px solid var(--r5-accent); background: #E7F5F7; }

/* --------------------------------------------------------------------------
   Search page
   -------------------------------------------------------------------------- */
.r5-search-bar { display: flex; gap: 10px; }
.r5-search-bar .form-control { flex: 1; padding: 12px 18px; border-radius: var(--r5-radius-lg); font-size: 16px; }
.r5-sort-label { font-size: 13px; color: var(--r5-subtext); font-weight: 600; }
.r5-select-auto { width: auto !important; display: inline-block; }
select.form-control.r5-select-auto {
  border: 1px solid var(--r5-border);
  border-radius: var(--r5-radius-md);
  padding: 9px 14px;
  background-color: var(--r5-surface);
}

/* --------------------------------------------------------------------------
   Auth pages (login / register / forgot password)
   -------------------------------------------------------------------------- */
.r5-auth-wrap { display: flex; justify-content: center; padding: 56px 20px 72px; }
.r5-auth-card { width: 100%; max-width: 400px; padding: 32px 28px; margin: 0; }
.r5-auth-title { font-size: 28px; font-weight: 800; letter-spacing: -0.7px; margin: 0 0 4px; }
.r5-auth-sub { font-size: 14px; color: var(--r5-subtext); margin: 0 0 24px; }
.r5-auth-field { text-align: left; margin-bottom: 14px; }
.r5-auth-field label { font-size: 13px; font-weight: 600; color: var(--r5-text); margin-bottom: 4px; display: block; }
.r5-auth-field input:not([type="checkbox"]) {
  width: 100%;
  background: var(--r5-bg);
  border: 1px solid var(--r5-border);
  border-radius: var(--r5-radius-md);
  padding: 10px 14px;
  font-size: 15px;
}
.r5-auth-field input:focus { outline: none; border-color: var(--r5-accent); box-shadow: 0 0 0 1.5px var(--r5-accent); }
.r5-auth-remember { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 16px; }
.r5-auth-remember label { margin: 0; font-weight: 600; }
.r5-auth-remember input[type="checkbox"] { accent-color: var(--r5-accent); width: 16px; height: 16px; }
.r5-auth-links { font-size: 13px; color: var(--r5-subtext); margin-top: 8px; }
input.r5-btn { cursor: pointer; width: 100%; }
.r5-search-bar input.r5-btn { width: auto; padding: 12px 28px; border-radius: var(--r5-radius-lg); flex-shrink: 0; }

/* Category listing page: 2-col pastel grid on desktop */
.r5-cat-grid-3 .r5-cat-tile { padding: 18px; }
@media (min-width: 768px) { .r5-cat-grid-3 { grid-template-columns: 1fr 1fr; } }

/* Article body — Canvas defaults give every block a 30px bottom margin, which
   flattens the hierarchy of long-form Delta output. Scope typography here. */
.r5-article-body { font-size: 15px; line-height: 1.55; padding: 28px 32px; max-width: 72ch; }

/* Canvas also gives paragraphs 27px of bottom padding. Reset it here so article
   rhythm is controlled by one compact gap rather than two stacked gaps. */
.r5-article-body p { margin-bottom: 8px; padding-bottom: 0; }

.r5-article-body h1 { font-size: 26px; }
.r5-article-body h2 { font-size: 23px; }
.r5-article-body h3 { font-size: 19px; }
.r5-article-body h1, .r5-article-body h2, .r5-article-body h3 {
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.3;
  color: var(--r5-text);
  margin: 40px 0 14px;
}
.r5-article-body > :first-child { margin-top: 0; }

.r5-article-body blockquote {
  font-size: inherit;
  font-style: italic;
  color: var(--r5-subtext);
  border-left: 3px solid var(--r5-accent);
  padding: 2px 0 2px 16px;
  margin: 22px 0;
}
.r5-article-body ul, .r5-article-body ol { margin: 0 0 22px; padding-left: 22px; }
.r5-article-body li { margin-bottom: 2px; }
.r5-article-body strong { font-weight: 700; color: var(--r5-text); }
.r5-article-body a { color: var(--r5-accent); text-decoration: underline; }
.r5-article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r5-radius-md);
  margin: 22px 0;
}
/* Editors paste colours that ignore the theme token. */
.r5-article-body span[style*="color"] { color: inherit !important; }

@media (max-width: 575.98px) {
  .r5-article-body { padding: 20px; }
  .r5-article-body h1 { font-size: 23px; }
  .r5-article-body h2 { font-size: 20px; }
}

/* Register (wider auth card) + profile */
.r5-auth-card-wide { max-width: 560px; }
.r5-auth-card .error, .r5-auth-card .show-error-msg { color: #FF3B30; font-size: 12px; margin-top: 4px; }
.r5-profile-name { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; }

/* Routine card — app-matched (mobile RoutineCard layout) */
.r5-card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13.5px;
  line-height: 1.45;
  color: #3A3A3C;
  word-break: break-word;
}
.r5-card-desc p { margin-bottom: 2px; }
.r5-card-desc ol, .r5-card-desc ul { margin-bottom: 2px; padding-left: 18px; }
.r5-card-desc li { margin-bottom: 0; }
.r5-card-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.r5-rating-group {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  color: #3A3A3C;
}
.r5-rating-group i { color: #F59E0B; font-size: 13px; }
.r5-meta-group {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--r5-subtext);
}
.r5-meta-group i { font-size: 11px; }
.r5-mine-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #E8E3F0;
  color: #6A4E93;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Responsive column stacking helper for the 3-col home layout
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .r5-main { padding: 12px 16px 40px; }
  .r5-section-title h1, h1.r5-h2 { font-size: 21px; }
  .r5-search-bar { flex-direction: column; }
  .r5-step-head { flex-direction: column; gap: 4px; }
  .r5-community-signin { align-items: stretch; flex-direction: column; }
  .r5-community-post { padding: 16px; }
  .r5-community-post-header { flex-direction: column; gap: 8px; }
  .r5-detail-byline-secondary { width: 100%; padding-left: 0; border-left: 0; }
  .r5-detail-stat-bar { grid-template-columns: 1fr 1fr; }
  .r5-detail-stat + .r5-detail-stat { border-left: 0; }
  .r5-detail-stat:nth-child(even) { border-left: 1px solid var(--r5-border); }
  .r5-detail-stat:nth-child(n+3) { border-top: 1px solid var(--r5-border); }
  .r5-how-grid { grid-template-columns: 1fr; }
}
