/* REALM components. Every colour, shadow and effect comes from tokens.css,
   so all of this works unchanged in Light, Dark and Midnight. Bootstrap
   components are restyled here through the same tokens - templates keep
   using plain Bootstrap markup. */

/* ============================================================ base */
html { -webkit-text-size-adjust: 100%; }
body {
  background-color: var(--r-canvas);
  color: var(--r-text);
  font-family: var(--r-font-sans);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
/* A theme's decorative background (Midnight's glow and grid) on its own fixed
   layer, which iPhone scrolls smoothly; nothing for REALM Light and Dark. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--r-page-image); background-size: var(--r-page-size); background-repeat: repeat;
  transform: translateZ(0);
}
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
a { color: var(--r-link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--r-accent); outline-offset: 2px; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--r-text); }
h1, .h1, .h2, .h3, main h1 { font-family: var(--r-font-serif); font-weight: 400; letter-spacing: -.005em; }
main h1 {
  width: fit-content;
  background-image: var(--r-heading-image); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: var(--r-heading-fill);
}
.text-center > h1 { margin-inline: auto; }
h2.text-uppercase, h3.text-uppercase, .r-label {
  font: 600 var(--r-type-label)/1.2 var(--r-font-sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--r-text-tertiary);
}
.r-label { display: flex; align-items: center; gap: var(--r-space-2); margin: 0 0 var(--r-space-3); }
.r-label .r-count, .r-label .text-body-secondary { letter-spacing: .04em; font-weight: 500; }
.r-meta { font-size: var(--r-type-meta); color: var(--r-text-tertiary); }
.r-help { font-size: var(--r-type-meta); color: var(--r-text-tertiary); }
.r-num, .hub-stat { font-variant-numeric: tabular-nums; }
.hub-stat {
  font-family: var(--r-font-serif); width: fit-content;
  background-image: var(--r-heading-image); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: var(--r-heading-fill);
}
.r-icon { width: 20px; height: 20px; flex: 0 0 auto; vertical-align: -4px;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.r-icon.sm { width: 16px; height: 16px; vertical-align: -3px; }
.r-icon.lg { width: 22px; height: 22px; }
.r-measure { max-width: 760px; }
.r-section { margin-bottom: var(--r-space-7); }
@media (min-width: 992px) { .r-section { margin-bottom: var(--r-space-8); } }
.r-panel { background: var(--r-surface); border: 1px solid var(--r-border); border-radius: var(--r-radius-lg);
  box-shadow: var(--r-shadow-1); padding: var(--r-space-5); }

/* ============================================================ shell */
.r-main {
  padding: var(--r-space-6) max(var(--r-gutter), env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(var(--r-gutter), env(safe-area-inset-left));
  min-width: 0;
}
/* Gutters are spacing, not text: on a phone keep Bootstrap's in px, so larger
   text can't push a row's negative margins past the page edge (a sideways
   scroll at 150-200%). Same widths as Bootstrap's at normal size. */
@media (max-width: 575.98px) {
  .r-main .row { --bs-gutter-x: 24px; }
  .r-main .row.g-2 { --bs-gutter-x: 8px; }
  .r-main .row.g-3 { --bs-gutter-x: 16px; }
}
.r-body { min-width: 0; }

.r-topbar {
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; gap: var(--r-space-4);
  padding: calc(env(safe-area-inset-top) + 8px) max(var(--r-gutter), env(safe-area-inset-right)) 8px max(var(--r-gutter), env(safe-area-inset-left));
  background: var(--r-bar); color: var(--r-bar-text);
  -webkit-backdrop-filter: saturate(1.2) blur(var(--r-blur)); backdrop-filter: saturate(1.2) blur(var(--r-blur));
  border-bottom: 1px solid var(--r-border);
}
.r-home-mark { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.r-home-mark > .r-mark { width: 28px; height: 28px; color: var(--r-mark); }
.r-word { font: 400 .95rem/1 var(--r-font-serif); letter-spacing: .26em; }
.r-spacer { flex: 1; }
.r-iconbtn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin: -6px;
  border: 0; background: none; border-radius: var(--r-radius-pill); color: var(--r-text-secondary);
  text-decoration: none; cursor: pointer;
}
.r-iconbtn:hover { color: var(--r-text); }
.r-avatar {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  background: var(--r-surface-sunken); color: var(--r-text-secondary); border: 1px solid var(--r-border);
  font: 600 .75rem/1 var(--r-font-sans); letter-spacing: .04em; text-decoration: none;
}

/* Phone tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  display: flex; justify-content: space-around;
  padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: var(--r-bar);
  -webkit-backdrop-filter: saturate(1.2) blur(var(--r-blur)); backdrop-filter: saturate(1.2) blur(var(--r-blur));
  border-top: 1px solid var(--r-border);
}
.tabbar a {
  flex: 1; max-width: 96px; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 4px;
  color: var(--r-text-tertiary); text-decoration: none; font: 500 .6875rem/1 var(--r-font-sans); letter-spacing: .02em;
}
.tabbar a .r-icon { width: 22px; height: 22px; }
.tabbar a.active { color: var(--r-tab-active); text-shadow: var(--r-tab-glow); }
.tabbar a.active::after {
  content: ""; position: absolute; bottom: -2px; width: 4px; height: 4px; border-radius: 50%;
  background: var(--r-accent); box-shadow: var(--r-tab-glow);
}

/* Desktop sidebar */
.r-sidebar { display: none; }
@media (min-width: 992px) {
  .r-app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
  .r-topbar, .tabbar { display: none; }
  .r-main { padding: var(--r-space-8) var(--r-space-8) var(--r-space-9); }
  .r-sidebar {
    display: flex; flex-direction: column; gap: var(--r-space-1);
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    padding: var(--r-space-6) var(--r-space-4) var(--r-space-5);
    background: var(--r-surface); border-right: 1px solid var(--r-border);
    -webkit-backdrop-filter: blur(var(--r-blur)); backdrop-filter: blur(var(--r-blur));
  }
}
.r-lockup { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; color: var(--r-text); text-decoration: none; }
.r-lockup > .r-mark { width: 34px; height: 34px; color: var(--r-mark); }
.r-lockup .r-word { font-size: 1.25rem; letter-spacing: .28em; margin-right: -.28em; }
.r-lockup .r-sub { display: block; font: 600 .5625rem/1 var(--r-font-sans); letter-spacing: .2em; text-transform: uppercase;
  color: var(--r-text-tertiary); margin-top: 6px; }
.r-nav { display: flex; flex-direction: column; gap: 2px; }
.r-nav a {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 10px;
  border-radius: var(--r-radius-sm); color: var(--r-text-secondary); text-decoration: none;
  font: 500 .9375rem/1.2 var(--r-font-sans);
  transition: background-color var(--r-dur-1) var(--r-ease), color var(--r-dur-1) var(--r-ease);
}
.r-nav a:hover, .r-nav a[aria-current="page"] { background: var(--r-selected); color: var(--r-text); }
.r-nav a[aria-current="page"]::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 2px; border-radius: 2px;
  background: var(--r-accent); box-shadow: var(--r-tab-glow);
}
.r-nav .r-nav-count { margin-left: auto; font-size: .75rem; color: var(--r-text-tertiary); font-variant-numeric: tabular-nums; }
.r-nav-label { font: 600 .625rem/1 var(--r-font-sans); letter-spacing: .16em; text-transform: uppercase;
  color: var(--r-text-tertiary); padding: 18px 10px 8px; }
.r-nav-rule { height: 1px; background: var(--r-border); margin: 12px 10px; }
.r-sidebar-foot { margin-top: auto; padding-top: var(--r-space-4); border-top: 1px solid var(--r-border);
  display: flex; flex-direction: column; gap: var(--r-space-3); }
.r-who { display: flex; align-items: center; gap: 10px; padding: 4px 10px; }
.r-who .r-name { font-weight: 600; font-size: .875rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-who .r-iconbtn { margin-left: auto; }

/* Appearance switch */
/* Four across; with large text on a narrow phone they wrap onto more rows,
   a short last row stretching to fill it. */
.r-appearance { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px;
  background: var(--r-surface-sunken); border-radius: var(--r-radius-xl); } /* a pill on one row, rounded when wrapped */
.r-appearance button {
  flex: 1 1 auto; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 36px;
  border: 0; border-radius: var(--r-radius-pill); background: none; cursor: pointer;
  color: var(--r-text-tertiary); font: 500 .75rem/1 var(--r-font-sans);
}
.r-appearance button .r-icon { width: 16px; height: 16px; }
.r-appearance button[aria-pressed="true"] { background: var(--r-surface); color: var(--r-text); box-shadow: var(--r-shadow-1), 0 0 0 1px var(--r-border); }
.r-appearance.compact { margin: 0 6px; flex-wrap: nowrap; } /* icons only: always four */
.r-appearance.compact button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.r-appearance-options { display: grid; gap: var(--r-space-2); }
@media (min-width: 576px) { .r-appearance-options { grid-template-columns: 1fr 1fr; } }
.r-appearance-option {
  position: relative; display: flex; align-items: center; gap: var(--r-space-3); padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--r-border); border-radius: var(--r-radius-md); background: var(--r-surface-raised);
}
.r-appearance-option input { position: absolute; opacity: 0; }
.r-appearance-option:has(input:checked) { border-color: var(--r-accent); box-shadow: 0 0 0 1px var(--r-accent); }
.r-appearance-option:has(input:focus-visible) { outline: 2px solid var(--r-accent); outline-offset: 2px; }
.r-appearance-option .r-option-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }

/* ============================================================ page header */
.r-pagehead { display: flex; align-items: center; gap: var(--r-space-4); margin-bottom: var(--r-space-6); flex-wrap: wrap; }
.r-pagehead-text { min-width: 0; }
.r-pagehead .r-title { margin: 0; font: 400 var(--r-type-title)/1.1 var(--r-font-serif); }
.r-pagehead .r-wordmark { margin: 0; font: 400 1.6rem/1 var(--r-font-serif); letter-spacing: .3em; margin-right: -.3em; }
@media (min-width: 992px) { .r-pagehead .r-wordmark { font-size: 1.9rem; } }
.r-pagehead .r-endorse { display: block; font: 600 .5625rem/1 var(--r-font-sans); letter-spacing: .2em; text-transform: uppercase;
  color: var(--r-text-tertiary); margin-top: 7px; }
.r-pagehead .r-subtitle { margin: 6px 0 0; color: var(--r-text-secondary); }
.r-pagehead .r-actions { margin-left: auto; display: flex; gap: var(--r-space-2); align-items: center; flex-wrap: wrap; }

/* An app's title with its tile, on the app's main page */
.r-apptitle { display: flex; align-items: center; gap: var(--r-space-3); min-width: 0; }
.r-apptitle h1 { margin: 0; min-width: 0; overflow-wrap: break-word; hyphens: auto; }

/* ============================================================ app tiles */
.r-tile {
  --t-bg: var(--r-tile-realm); --t-ink: var(--r-tile-realm-ink); --t-ring: var(--r-tile-realm-ring, var(--t-bg));
  display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 22%;
  border: 1.5px solid transparent;
  background: linear-gradient(var(--t-bg), var(--t-bg)) padding-box, var(--t-ring) border-box;
  color: var(--t-ink); box-shadow: var(--r-tile-shadow), inset 0 0 0 1px var(--r-tile-edge);
}
.r-tile .r-icon { width: 52%; height: 52%; filter: drop-shadow(0 0 var(--r-glow-size) color-mix(in srgb, var(--t-ink) 55%, transparent)); }
.r-tile .r-tile-mark { width: 72%; height: 72%; color: var(--r-mark); }
.r-tile.xs { width: 26px; height: 26px; border-radius: 7px; border-width: 1px; }
.r-tile.sm { width: 32px; height: 32px; border-radius: 8px; border-width: 1px; }
.r-tile.lg { width: 56px; height: 56px; }
.r-tile.xl { width: 72px; height: 72px; }
.r-tile.t-tasks { --t-bg: var(--r-tile-tasks); --t-ink: var(--r-tile-tasks-ink); --t-ring: var(--r-tile-tasks-ring, var(--t-bg)); }
.r-tile.t-trips { --t-bg: var(--r-tile-trips); --t-ink: var(--r-tile-trips-ink); --t-ring: var(--r-tile-trips-ring, var(--t-bg)); }
.r-tile.t-recipes { --t-bg: var(--r-tile-recipes); --t-ink: var(--r-tile-recipes-ink); --t-ring: var(--r-tile-recipes-ring, var(--t-bg)); }
.r-tile.t-cards { --t-bg: var(--r-tile-cards); --t-ink: var(--r-tile-cards-ink); --t-ring: var(--r-tile-cards-ring, var(--t-bg)); }
.r-tile.t-subscriptions { --t-bg: var(--r-tile-subscriptions); --t-ink: var(--r-tile-subscriptions-ink); --t-ring: var(--r-tile-subscriptions-ring, var(--t-bg)); }
.r-tile.t-expenses { --t-bg: var(--r-tile-expenses); --t-ink: var(--r-tile-expenses-ink); --t-ring: var(--r-tile-expenses-ring, var(--t-bg)); }
.r-tile.t-wellbeing { --t-bg: var(--r-tile-wellbeing); --t-ink: var(--r-tile-wellbeing-ink); --t-ring: var(--r-tile-wellbeing-ring, var(--t-bg)); }
.r-tile.t-inbox { --t-bg: var(--r-tile-inbox); --t-ink: var(--r-tile-inbox-ink); --t-ring: var(--r-tile-inbox-ring, var(--t-bg)); }
.r-tile.t-ask { --t-bg: var(--r-tile-ask); --t-ink: var(--r-tile-ask-ink); --t-ring: var(--r-tile-ask-ring, var(--t-bg)); }
.r-tile.t-addressbook { --t-bg: var(--r-tile-addressbook); --t-ink: var(--r-tile-addressbook-ink); --t-ring: var(--r-tile-addressbook-ring, var(--t-bg)); opacity: .7; }

/* ============================================================ Bootstrap components */
.btn {
  --bs-btn-font-weight: 600; --bs-btn-border-radius: var(--r-radius-md); --bs-btn-padding-y: .55rem; --bs-btn-padding-x: 1.1rem;
  --bs-btn-focus-box-shadow: 0 0 0 3px color-mix(in srgb, var(--r-accent) 35%, transparent);
  letter-spacing: .01em; transition: background-color var(--r-dur-1) var(--r-ease), border-color var(--r-dur-1) var(--r-ease), transform var(--r-dur-1) var(--r-ease);
}
.btn:active { transform: scale(.98); }
.btn-sm { --bs-btn-border-radius: var(--r-radius-sm); --bs-btn-padding-y: .35rem; --bs-btn-padding-x: .8rem; }
.btn-primary {
  --bs-btn-bg: var(--r-action); --bs-btn-border-color: var(--r-action); --bs-btn-color: var(--r-action-ink);
  --bs-btn-hover-bg: var(--r-action-hover); --bs-btn-hover-border-color: var(--r-action-hover); --bs-btn-hover-color: var(--r-action-ink);
  --bs-btn-active-bg: var(--r-action-hover); --bs-btn-active-border-color: var(--r-action-hover); --bs-btn-active-color: var(--r-action-ink);
  --bs-btn-disabled-bg: var(--r-action); --bs-btn-disabled-border-color: var(--r-action); --bs-btn-disabled-color: var(--r-action-ink);
  background-image: var(--r-action-image); box-shadow: var(--r-action-glow);
}
.btn-primary:hover, .btn-primary:active { background-image: var(--r-action-image); }
.btn-outline-secondary, .btn-secondary, .btn-outline-primary, .btn-outline-light, .btn-light {
  --bs-btn-color: var(--r-text); --bs-btn-bg: transparent; --bs-btn-border-color: var(--r-border-strong);
  --bs-btn-hover-color: var(--r-text); --bs-btn-hover-bg: var(--r-selected); --bs-btn-hover-border-color: var(--r-border-strong);
  --bs-btn-active-color: var(--r-text); --bs-btn-active-bg: var(--r-selected); --bs-btn-active-border-color: var(--r-border-strong);
  --bs-btn-disabled-color: var(--r-text-tertiary); --bs-btn-disabled-border-color: var(--r-border);
}
.btn-outline-danger, .btn-danger {
  --bs-btn-color: var(--r-danger); --bs-btn-bg: transparent; --bs-btn-border-color: color-mix(in srgb, var(--r-danger) 55%, transparent);
  --bs-btn-hover-color: var(--r-canvas); --bs-btn-hover-bg: var(--r-danger); --bs-btn-hover-border-color: var(--r-danger);
  --bs-btn-active-color: var(--r-canvas); --bs-btn-active-bg: var(--r-danger); --bs-btn-active-border-color: var(--r-danger);
}
.btn-outline-success, .btn-success {
  --bs-btn-color: var(--r-success); --bs-btn-bg: transparent; --bs-btn-border-color: color-mix(in srgb, var(--r-success) 55%, transparent);
  --bs-btn-hover-color: var(--r-canvas); --bs-btn-hover-bg: var(--r-success); --bs-btn-hover-border-color: var(--r-success);
}
.btn-outline-warning, .btn-warning {
  --bs-btn-color: var(--r-warning); --bs-btn-bg: transparent; --bs-btn-border-color: color-mix(in srgb, var(--r-warning) 55%, transparent);
  --bs-btn-hover-color: var(--r-canvas); --bs-btn-hover-bg: var(--r-warning); --bs-btn-hover-border-color: var(--r-warning);
}
.btn-link { --bs-btn-color: var(--r-link); --bs-btn-hover-color: var(--r-text); --bs-btn-active-color: var(--r-text); font-weight: 500; }
.btn-close { filter: var(--r-close-filter, none); }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

.card {
  --bs-card-bg: var(--r-surface); --bs-card-border-color: var(--r-border); --bs-card-border-radius: var(--r-radius-lg);
  --bs-card-cap-bg: var(--r-surface-sunken);
  box-shadow: var(--r-shadow-1);
}
.list-group {
  --bs-list-group-bg: var(--r-surface); --bs-list-group-color: var(--r-text); --bs-list-group-border-color: var(--r-border);
  --bs-list-group-border-radius: var(--r-radius-lg);
  --bs-list-group-action-hover-bg: var(--r-selected); --bs-list-group-action-hover-color: var(--r-text);
  --bs-list-group-action-active-bg: var(--r-selected); --bs-list-group-action-color: var(--r-text);
  --bs-list-group-active-bg: var(--r-action); --bs-list-group-active-border-color: var(--r-action); --bs-list-group-active-color: var(--r-action-ink);
  box-shadow: var(--r-shadow-1);
}
.nav-pills {
  --bs-nav-pills-link-active-bg: var(--r-surface); --bs-nav-pills-link-active-color: var(--r-text);
  --bs-nav-pills-border-radius: var(--r-radius-pill); --bs-nav-link-color: var(--r-text-secondary); --bs-nav-link-hover-color: var(--r-text);
  display: inline-flex; flex-wrap: nowrap; gap: 2px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  background: var(--r-surface-sunken); border-radius: var(--r-radius-pill);
}
.nav-pills::-webkit-scrollbar { display: none; }
.nav-pills .nav-link { white-space: nowrap; padding: .45rem 1rem; font-weight: 500; }
.nav-pills .nav-link.active {
  box-shadow: var(--r-shadow-1), 0 0 0 1px var(--r-border);
  background-image: var(--r-action-image); color: var(--r-text);
}
[data-theme="midnight"] .nav-pills .nav-link.active { color: var(--r-action-ink); box-shadow: var(--r-action-glow); }
.nav-tabs { --bs-nav-tabs-border-color: var(--r-border); --bs-nav-tabs-link-active-bg: var(--r-surface);
  --bs-nav-tabs-link-active-color: var(--r-text); --bs-nav-tabs-link-active-border-color: var(--r-border) var(--r-border) var(--r-surface);
  --bs-nav-link-color: var(--r-text-secondary); }

.form-control, .form-select {
  --bs-body-bg: var(--r-surface-sunken);
  min-height: 44px; font-size: 1rem; /* 16 px: no iOS zoom */
  background-color: var(--r-surface-sunken); border-color: var(--r-border-strong); color: var(--r-text);
  border-radius: var(--r-radius-md);
}
.form-control-sm, .form-select-sm { font-size: 1rem; min-height: 38px; padding-top: .3rem; padding-bottom: .3rem; }
.form-control::placeholder { color: var(--r-text-tertiary); }
.form-control:focus, .form-select:focus {
  background-color: var(--r-surface-sunken); color: var(--r-text); border-color: var(--r-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--r-accent) 28%, transparent);
}
.form-control:disabled, .form-select:disabled { opacity: .6; }
.form-label { font-weight: 600; font-size: .8125rem; color: var(--r-text-secondary); }
.form-text { color: var(--r-text-tertiary); }
.form-check-input { background-color: var(--r-surface-sunken); border-color: var(--r-border-strong); }
.form-check-input:checked { background-color: var(--r-accent); border-color: var(--r-accent); }
.form-check-input:focus { border-color: var(--r-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--r-accent) 28%, transparent); }
.input-group-text { background: var(--r-surface); border-color: var(--r-border-strong); color: var(--r-text-secondary); }

.alert {
  --bs-alert-bg: var(--r-surface); --bs-alert-color: var(--r-text); --bs-alert-border-color: var(--r-border);
  border-radius: var(--r-radius-md); border-left: 3px solid var(--r-info); box-shadow: var(--r-shadow-1);
}
.alert-success { border-left-color: var(--r-success); }
.alert-warning { border-left-color: var(--r-warning); }
.alert-danger { border-left-color: var(--r-danger); }
.alert .alert-link { color: var(--r-link); }
.badge { font-weight: 500; border-radius: var(--r-radius-pill); }
.text-bg-secondary-subtle, .badge.text-bg-secondary-subtle {
  background: var(--r-surface-sunken) !important; color: var(--r-text-secondary) !important; border: 1px solid var(--r-border);
}
.text-bg-primary { background: var(--r-action) !important; color: var(--r-action-ink) !important; }
.text-bg-warning { background: color-mix(in srgb, var(--r-warning) 18%, var(--r-surface)) !important; color: var(--r-warning) !important; }
.text-bg-success { background: color-mix(in srgb, var(--r-success) 18%, var(--r-surface)) !important; color: var(--r-success) !important; }
.text-bg-danger { background: color-mix(in srgb, var(--r-danger) 18%, var(--r-surface)) !important; color: var(--r-danger) !important; }
.bg-body-secondary { background-color: var(--r-surface-sunken) !important; }
.bg-body-tertiary { background-color: var(--r-surface) !important; }
.progress { --bs-progress-bg: var(--r-surface-sunken); --bs-progress-bar-bg: var(--r-accent); --bs-progress-border-radius: var(--r-radius-pill); }
.progress-bar { background-image: var(--r-action-image); }
.dropdown-menu { --bs-dropdown-bg: var(--r-surface-raised); --bs-dropdown-border-color: var(--r-border); --bs-dropdown-link-color: var(--r-text);
  --bs-dropdown-link-hover-bg: var(--r-selected); --bs-dropdown-link-hover-color: var(--r-text); box-shadow: var(--r-shadow-2); }
.table { --bs-table-bg: transparent; --bs-table-color: var(--r-text); --bs-table-border-color: var(--r-border); }
.accordion { --bs-accordion-bg: var(--r-surface); --bs-accordion-border-color: var(--r-border); --bs-accordion-btn-bg: var(--r-surface);
  --bs-accordion-active-bg: var(--r-selected); --bs-accordion-active-color: var(--r-text); --bs-accordion-btn-color: var(--r-text); }
hr { border-color: var(--r-border); opacity: 1; }

/* ============================================================ sheets
   Bootstrap fixes bottom sheets at 30vh; size to content up to most of the
   screen instead (dvh tracks Safari's toolbars). */
.offcanvas { --bs-offcanvas-bg: var(--r-surface); --bs-offcanvas-color: var(--r-text); --bs-offcanvas-border-color: var(--r-border); }
.offcanvas-backdrop { --bs-backdrop-bg: var(--r-scrim); --bs-backdrop-opacity: 1; }
.offcanvas.offcanvas-bottom.more-sheet { --bs-offcanvas-height: auto; max-height: 85vh; max-height: 85dvh; }
.more-sheet .offcanvas-body { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.more-sheet { height: auto; max-height: 85vh; border-top: 1px solid var(--r-border); border-radius: var(--r-radius-xl) var(--r-radius-xl) 0 0;
  padding-bottom: env(safe-area-inset-bottom); box-shadow: var(--r-shadow-2); }
.r-grab { width: 36px; height: 4px; border-radius: 4px; background: var(--r-border-strong); opacity: .5; margin: 10px auto 0; flex: 0 0 auto; }
.inbox-sheet { max-height: 92vh; }
@media (min-width: 992px) {
  /* On a computer bottom sheets become panels: All apps opens beside the
     sidebar, the Inbox Add sheet drops into the middle. */
  .offcanvas.offcanvas-bottom.more-sheet {
    top: 1.5rem; bottom: auto; right: auto; left: 268px; width: 26rem;
    max-height: calc(100vh - 3rem); margin: 0; border: 1px solid var(--r-border); border-radius: var(--r-radius-lg);
    transform: translateY(-.75rem); opacity: 0;
    transition: transform var(--r-dur-2) ease-out, opacity var(--r-dur-2) ease-out, visibility var(--r-dur-2);
  }
  .offcanvas.offcanvas-bottom.more-sheet.showing,
  .offcanvas.offcanvas-bottom.more-sheet.show:not(.hiding) { transform: none; opacity: 1; }
  .offcanvas.offcanvas-bottom.inbox-sheet { width: 34rem; left: 50%; margin-left: -17rem; top: 5rem; }
  .more-sheet .r-grab { display: none; }
}
.more-icon { color: var(--r-text-secondary); }
/* The Apps sheet: a search box, a grid of app tiles (a star keeps one on the
   bar), then Roadmap, ideas and account links. */
.apps-sheet .offcanvas-title { font: 400 2.125rem/1.1 var(--r-font-serif); letter-spacing: -.01em; }
.apps-search { position: relative; display: block; margin: 0; }
.apps-search > .r-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--r-text-tertiary); }
.apps-search input { padding-left: 44px; min-height: 46px; border-radius: var(--r-radius-pill); background: transparent;
  border-color: var(--r-border-strong); }
/* An open icon grid (no cards): app icons with their names under them -
   three across on most phones, fewer with narrow screens or larger text, as
   columns are sized in rem. Names and counts wrap; nothing has a fixed
   height. A quiet gold dot marks a favorite (screen readers hear
   ", favorite"). "Edit favorites" swaps each link for a toggle with a
   visible check, so choosing never opens an app. */
.apps-edit { padding: 10px 8px; min-height: 44px; color: var(--r-accent, var(--r-mark)); font-size: .9375rem; font-weight: 500; text-decoration: none; }
.apps-edit + .btn-close { margin-left: 4px; }
/* With big text on a narrow phone, Edit favorites and close drop below the title. */
.apps-sheet .offcanvas-header { flex-wrap: wrap; row-gap: 0; }
.apps-sheet .btn-close { flex-shrink: 0; }
/* Midnight's surface is see-through glass; as a sheet over the page it let
   the page's words show through the grid. */
[data-theme="midnight"] .apps-sheet { --bs-offcanvas-bg: var(--r-canvas);
  background-image: linear-gradient(var(--r-surface), var(--r-surface)); }
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.25rem, 1fr)); gap: 18px 4px; }
.apps-item[hidden] { display: none; }
.apps-open, .apps-fav { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; min-height: 44px;
  padding: 4px 2px; border: 0; background: none; border-radius: var(--r-radius-lg, 14px); color: var(--r-text);
  text-decoration: none; font-size: .9375rem; font-weight: 500; line-height: 1.25; text-align: center;
  overflow-wrap: anywhere; hyphens: auto; }
.apps-open .r-meta { font-weight: 400; }
.apps-open[hidden], .apps-fav[hidden] { display: none; }
.apps-open:hover, .apps-fav:hover { color: var(--r-text); }
.apps-open:hover .r-tile, .apps-fav:hover .r-tile { filter: brightness(1.06); }
.apps-open:focus-visible, .apps-fav:focus-visible { outline: 2px solid var(--r-focus, currentColor); outline-offset: 2px; }
.apps-icon { position: relative; display: inline-flex; }
/* The sheet's icons: one size and finish for every app - a filled tile with
   a soft top light, a hairline edge a shade lighter than its fill, and a
   shadow - sized with the phone (about 74px on a 390px screen). */
.apps-icon .r-tile.lg { width: clamp(56px, 19vw, 76px); height: clamp(56px, 19vw, 76px); border-radius: 24%;
  background-image: radial-gradient(120% 90% at 50% 0%, rgb(255 255 255 / .10), transparent 70%);
  background-color: var(--t-bg);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--t-bg) 84%, var(--r-text)), inset 0 2px 0 rgb(255 255 255 / .06),
    0 12px 20px -12px rgb(0 0 0 / .6); }
.apps-icon .r-tile.lg .r-icon { width: 46%; height: 46%; stroke-width: 1.6; }
/* Light: the pale tiles (Trips, Inbox, Ask) take a deeper sand, so they hold
   their own on the light sheet beside the dark ones. */
[data-theme="light"] .apps-icon .r-tile.lg {
  box-shadow: inset 0 0 0 1px rgb(42 35 28 / .10), inset 0 1px 0 rgb(255 255 255 / .18),
    0 10px 18px -10px rgb(42 35 28 / .45); }
[data-theme="light"] .apps-icon .r-tile.lg:is(.t-trips, .t-inbox, .t-ask, .t-realm) {
  background-color: color-mix(in srgb, var(--t-bg) 82%, var(--r-tile-ask-ink)); }
/* Midnight keeps its glowing gradient rings. */
[data-theme="midnight"] .apps-icon .r-tile.lg {
  background: linear-gradient(var(--t-bg), var(--t-bg)) padding-box, var(--t-ring) border-box; box-shadow: var(--r-tile-shadow); }
.apps-dot { position: absolute; top: -4px; right: -4px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--r-star); box-shadow: 0 0 0 2.5px var(--bs-offcanvas-bg, var(--r-surface)), var(--r-star-glow, none); display: none; }
.apps-item.is-fav .apps-dot { display: block; }
.apps-check { position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%; display: grid;
  place-items: center; border: 1.5px solid var(--r-border-strong); background: var(--bs-offcanvas-bg, var(--r-surface)); color: transparent; }
.apps-check .r-icon { width: 14px; height: 14px; stroke-width: 2.4; }
.apps-fav[aria-pressed="true"] .apps-check { background: var(--r-star); border-color: var(--r-star); color: var(--r-canvas); }
.apps-sheet.editing .apps-fixed { opacity: .45; }
.apps-links { display: grid; margin-top: 28px; border-top: 1px solid var(--r-border); }
.apps-links a { display: flex; align-items: center; gap: var(--r-space-4, 16px); min-height: 54px; color: var(--r-text); text-decoration: none; font-size: .9375rem; }
.apps-links .more-icon { width: 22px; height: 22px; }
.apps-links a + a { border-top: 1px solid var(--r-border); }
.apps-links a > span { flex: 1; }
.apps-links a > .r-icon:last-child { color: var(--r-text-tertiary); }
.r-soon { font: 600 .625rem/1 var(--r-font-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--r-text-tertiary);
  border: 1px solid var(--r-border); border-radius: var(--r-radius-pill); padding: 5px 8px; white-space: nowrap; }

/* ============================================================ auth pages */
.r-auth { max-width: 26rem; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 3rem) var(--r-gutter) 3rem; }
.r-auth-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 28px; color: var(--r-text); text-decoration: none; }
.r-auth-brand .r-mark { width: 56px; height: 56px; color: var(--r-mark); }
.r-auth-brand .r-word { font-size: 1.6rem; letter-spacing: .32em; margin-right: -.32em; }
.r-auth-brand .r-sub { font: 600 .625rem/1 var(--r-font-sans); letter-spacing: .2em; text-transform: uppercase;
  color: var(--r-text-tertiary); margin-top: -6px; }
.auth-card {
  background: var(--r-surface); border: 1px solid var(--r-border); border-radius: var(--r-radius-lg);
  padding: 2rem; box-shadow: var(--r-shadow-2);
}
.auth-card h1 { font-size: 1.5rem; }

/* ============================================================ home */
.r-greeting { margin: 0; font: 400 var(--r-type-display)/1.08 var(--r-font-serif); letter-spacing: -.012em; text-wrap: balance;
  width: fit-content; background-image: var(--r-heading-image); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: var(--r-heading-fill); }
.r-dateline { margin: 10px 0 0; color: var(--r-text-secondary); }
.r-hero { margin-bottom: var(--r-space-7); max-width: 760px; }
.r-group {
  background: var(--r-surface); border: 1px solid var(--r-border); border-radius: var(--r-radius-lg);
  box-shadow: var(--r-shadow-1); overflow: hidden;
}
.r-group > * + * { border-top: 1px solid var(--r-border); }
.r-linkrow {
  display: flex; align-items: center; gap: var(--r-space-4); padding: 14px 16px; min-height: 64px;
  color: inherit; text-decoration: none; transition: background-color var(--r-dur-1) var(--r-ease);
}
a.r-linkrow:hover { color: inherit; }
@media (hover: hover) { a.r-linkrow:hover { background: var(--r-selected); } }
.r-linkrow .r-body { flex: 1; min-width: 0; }
.r-linkrow .r-title { font-weight: 600; }
.r-linkrow .r-sub { display: block; font-size: .875rem; color: var(--r-text-secondary); margin-top: 1px; }
.r-linkrow > .r-trail, .r-linkrow > .r-icon.r-trail { color: var(--r-text-tertiary); display: flex; align-items: center; gap: 6px; font-size: .8125rem; white-space: nowrap; }
.inbox-row { /* the Home Inbox row: one linkrow on its own surface */
  display: flex; align-items: center; gap: var(--r-space-4); padding: 14px 16px; text-decoration: none; color: inherit;
  background: var(--r-surface); border: 1px solid var(--r-border); border-radius: var(--r-radius-lg); box-shadow: var(--r-shadow-1);
}
.inbox-row:hover { color: inherit; border-color: var(--r-border-strong); }
.inbox-row > .flex-grow-1, .inbox-row-count { min-width: 0; }
.r-apps { display: grid; gap: 0; }
@media (min-width: 720px) {
  .r-apps.r-group { grid-template-columns: repeat(2, minmax(0, 1fr)); background: none; border: 0; box-shadow: none; gap: var(--r-space-4); overflow: visible; }
  .r-apps.r-group > * + * { border-top: 0; }
  .r-apps .r-linkrow { background: var(--r-surface); border: 1px solid var(--r-border); border-radius: var(--r-radius-lg); box-shadow: var(--r-shadow-1); padding: 18px; min-height: 92px; }
  .r-apps .r-linkrow .r-title { font: 400 1.1875rem/1.2 var(--r-font-serif); }
}
@media (min-width: 1200px) { .r-apps.r-group { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.r-composer {
  display: flex; align-items: flex-end; gap: var(--r-space-2);
  padding: 6px 6px 6px 16px; border-radius: var(--r-radius-xl);
  background: var(--r-surface); border: 1px solid var(--r-border); box-shadow: var(--r-shadow-1);
  transition: border-color var(--r-dur-1) var(--r-ease), box-shadow var(--r-dur-1) var(--r-ease);
}
.r-composer:focus-within { border-color: var(--r-accent); box-shadow: var(--r-shadow-1), 0 0 0 3px color-mix(in srgb, var(--r-accent) 22%, transparent); }
.r-composer > .r-icon { align-self: center; color: var(--r-accent-ink); }
.r-composer .form-control, .r-composer textarea, .r-composer input[type="text"] {
  flex: 1; min-width: 0; border: 0; background: none; box-shadow: none; outline: none; resize: none;
  padding: 11px 0; font-size: 1rem; line-height: 1.4; color: var(--r-text); min-height: 44px; max-height: 160px;
}
.r-composer textarea { field-sizing: content; }
.r-composer .form-control:focus { box-shadow: none; background: none; }
.r-composer .r-iconbtn { margin: 0; width: 40px; height: 40px; }
.r-send {
  flex: 0 0 auto; display: inline-grid; place-items: center; width: 40px; height: 40px; margin: 2px; padding: 0;
  border: 0; border-radius: 50%; background: var(--r-action); background-image: var(--r-action-image); color: var(--r-action-ink);
  box-shadow: var(--r-action-glow); cursor: pointer; transition: transform var(--r-dur-1) var(--r-ease);
}
.r-send:hover { background-color: var(--r-action-hover); }
.r-send:active { transform: scale(.94); }
.r-send:disabled { opacity: .6; }
.r-send .r-icon { stroke-width: 1.8; }
.r-moving { display: flex; align-items: center; gap: 6px; color: var(--r-warning); font-size: .8125rem; margin-top: 3px; }
.trip-moving { color: var(--r-warning); }

/* ============================================================ CUE */
.r-segmented { /* spaces */
  display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-radius-pill); background: var(--r-surface-sunken);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.r-segmented::-webkit-scrollbar { display: none; }
.r-segmented a {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 16px; border-radius: var(--r-radius-pill);
  white-space: nowrap; color: var(--r-text-secondary); text-decoration: none; font-weight: 500;
}
.r-segmented .r-count { color: var(--r-text-tertiary); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.r-segmented a.active { background: var(--r-surface); color: var(--r-text); box-shadow: var(--r-shadow-1), 0 0 0 1px var(--r-border);
  background-image: var(--r-action-image); }
[data-theme="midnight"] .r-segmented a.active, [data-theme="midnight"] .r-segmented a.active .r-count { color: var(--r-action-ink); }

/* Lists and tags: each carries its own colour as --tag (var(--r-tag-<name>)) */
.pill-row { display: flex; gap: var(--r-space-2); overflow-x: auto; scrollbar-width: none; padding: 2px var(--r-gutter);
  margin-inline: calc(var(--r-gutter) * -1);
  -webkit-mask-image: linear-gradient(90deg, transparent, black var(--r-gutter), black calc(100% - var(--r-gutter)), transparent);
  mask-image: linear-gradient(90deg, transparent, black var(--r-gutter), black calc(100% - var(--r-gutter)), transparent); }
@media (min-width: 992px) { .pill-row { flex-wrap: wrap; margin-inline: 0; padding-inline: 0; -webkit-mask-image: none; mask-image: none; } }
.pill-row::-webkit-scrollbar { display: none; }
.tag-pill {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 13px;
  border-radius: var(--r-radius-pill); border: 1px solid color-mix(in srgb, var(--tag) 40%, transparent);
  color: var(--tag); text-decoration: none; white-space: nowrap; font-size: .8125rem; font-weight: 500;
}
.tag-pill:hover { color: var(--tag); background: color-mix(in srgb, var(--tag) var(--r-tag-tint), transparent); }
.tag-pill .r-swatch { width: 7px; height: 7px; border-radius: 50%; background: var(--tag); }
.tag-pill .r-count { opacity: .75; font-variant-numeric: tabular-nums; }
.tag-pill .r-icon, .tag-pill .bi { width: 14px; height: 14px; font-size: .8rem; }
.tag-pill.active { color: var(--r-canvas); background: var(--tag); border-color: var(--tag); box-shadow: 0 0 var(--r-glow-size) color-mix(in srgb, var(--tag) 60%, transparent); }
.tag-pill.active .r-swatch { background: var(--r-canvas); }
.tag-pill-sm { min-height: 30px; }
.tag-chip {
  display: inline-flex; align-items: center; padding: 0 7px; height: 20px; border-radius: 6px;
  font-size: .75rem; font-weight: 500; color: var(--tag); background: color-mix(in srgb, var(--tag) var(--r-tag-tint), transparent);
}
.list-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--r-text-secondary); }
.list-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tag); }
.tag-dot { flex: 0 0 auto; width: .8rem; height: .8rem; border-radius: 50%; background: var(--tag); }
.tag-check { position: relative; display: inline-flex; cursor: pointer; }
.tag-check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tag-check span {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 13px; border-radius: var(--r-radius-pill);
  border: 1px solid color-mix(in srgb, var(--tag, var(--r-text-secondary)) 40%, transparent);
  color: var(--tag, var(--r-text-secondary)); font-size: .8125rem; font-weight: 500;
}
.tag-check input:checked + span { color: var(--r-canvas); background: var(--tag, var(--r-text-secondary)); border-color: var(--tag, var(--r-text-secondary)); }
.tag-check input:focus-visible + span { outline: 2px solid var(--r-accent); outline-offset: 2px; }
.due-chips { flex-wrap: wrap; }
.due-chips .tag-check { --tag: var(--r-text-secondary); }

/* Quick-add */
.r-quickadd { margin-bottom: var(--r-space-6); }
/* On a phone, get to the tasks sooner: a tighter header and filter stack,
   the explanatory line hidden (the placeholder says enough). Tap targets stay. */
@media (max-width: 991.98px) {
  .r-cue { padding-top: var(--r-space-4); }
  .r-cue-head { margin-bottom: var(--r-space-4); gap: var(--r-space-3); }
  .r-cue-head .r-tile.lg { width: 44px; height: 44px; }
  .r-cue-head .r-wordmark { font-size: 1.4rem; }
  .r-cue .r-quickadd { margin-bottom: var(--r-space-5); }
  .r-cue .r-quickadd-row { margin-top: 8px; }
}
@media (max-width: 575.98px) { .r-cue .r-quickadd-help { display: none; } }
.r-quickadd-row { display: flex; align-items: center; gap: var(--r-space-2); flex-wrap: wrap; margin-top: 10px; }

/* Task rows */
.r-tasks { padding: 0; }
.r-task { position: relative; display: flex; align-items: flex-start; gap: 4px; padding: 0 6px 0 4px; min-height: 52px;
  transition: background-color var(--r-dur-1) var(--r-ease); }
@media (hover: hover) { .r-task:hover { background: var(--r-selected); } }
.r-tasks > .r-task + .r-task { border-top: 0; }
.r-task + .r-task::before { content: ""; position: absolute; top: 0; left: 52px; right: 0; height: 1px; background: var(--r-border); }
.r-task form { margin: 0; }
.r-check, .r-star {
  flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; margin-top: 4px;
  border: 0; background: none; cursor: pointer; padding: 0; border-radius: 50%; color: inherit;
}
.r-check i {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--r-border-strong); transition: background-color var(--r-dur-1) var(--r-ease), border-color var(--r-dur-1) var(--r-ease);
}
.r-check i .r-icon { width: 14px; height: 14px; color: var(--r-canvas); stroke-width: 2.2; opacity: 0; }
.r-check:hover i { border-color: var(--r-text-secondary); }
.r-task.done .r-check i { background: var(--r-success); border-color: var(--r-success); }
.r-task.done .r-check i .r-icon { opacity: 1; }
.r-task-body { flex: 1; min-width: 0; padding: 11px 0 10px; color: inherit; text-decoration: none; }
.r-task-body:hover { color: inherit; }
.r-task-title { line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.r-task.done .r-task-title { color: var(--r-text-tertiary); text-decoration: line-through; text-decoration-thickness: 1px; }
.r-task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px;
  font-size: var(--r-type-meta); color: var(--r-text-tertiary); }
.r-task-meta .r-overdue { color: var(--r-danger); font-weight: 500; }
.r-task-meta .r-today { color: var(--r-text-secondary); font-weight: 500; }
.r-task-meta .r-icon { width: 13px; height: 13px; vertical-align: -2px; }
.r-task-meta .r-note { flex-basis: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-star { color: var(--r-text-tertiary); }
.r-star:hover { color: var(--r-text-secondary); }
.r-star .r-icon { width: 20px; height: 20px; }
.focus-star.on { color: var(--r-star); filter: drop-shadow(var(--r-star-glow)); }
.focus-star.on .r-icon { fill: currentColor; }
.focus-list { border-color: color-mix(in srgb, var(--r-star) 55%, var(--r-border)); }
.focus-heading { color: var(--r-star); }
.grocery-amount { font-weight: 600; color: var(--r-accent-ink); font-variant-numeric: tabular-nums; }
.r-disclosure > summary { list-style: none; cursor: pointer; }
.r-disclosure > summary::-webkit-details-marker { display: none; }
.r-disclosure > summary .r-icon { transition: transform var(--r-dur-2) var(--r-ease); }
.r-disclosure[open] > summary .r-icon { transform: rotate(180deg); }
.r-hint { display: flex; align-items: center; gap: 10px; color: var(--r-text-tertiary); font-size: .875rem; flex-wrap: wrap; }
.org-row > summary { list-style: none; cursor: pointer; }
.org-row > summary::-webkit-details-marker { display: none; }
.org-row[open] .org-chevron { transform: rotate(180deg); }

/* ============================================================ Inbox */
.inbox-icon { width: 2.3rem; height: 2.3rem; border-radius: .6rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; border: 1px solid var(--r-border); color: var(--r-accent-ink); background: var(--r-surface-sunken); }
.inbox-add-btn { padding: .8rem; font-size: 1.05rem; border-radius: var(--r-radius-lg); }
.inbox-state { font-size: .72rem; padding: .15rem .5rem; border-radius: 1rem; flex-shrink: 0; max-width: 100%;
  border: 1px solid var(--r-border); color: var(--r-text-secondary); }
.inbox-state-review { color: var(--r-accent-ink); border-color: color-mix(in srgb, var(--r-accent) 55%, transparent); }
.inbox-state-working { color: var(--r-text); }
.inbox-state-done { color: var(--r-success); border-color: color-mix(in srgb, var(--r-success) 45%, transparent); }
.inbox-state-problem { color: var(--r-warning); border-color: color-mix(in srgb, var(--r-warning) 45%, transparent); }
.inbox-state .spinner-grow { width: .45rem; height: .45rem; vertical-align: middle; }
.inbox-pick { display: flex; align-items: center; gap: .85rem; width: 100%; padding: 1rem;
  border: 1.5px dashed var(--r-border-strong); border-radius: var(--r-radius-lg); cursor: pointer; }
.inbox-pick > .bi { font-size: 1.6rem; color: var(--r-accent-ink); }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  margin-right: .35rem; font-size: .8rem; border: 1px solid var(--r-accent); color: var(--r-accent-ink); }

/* ============================================================ Trips */
.trip-work { --trip-c: var(--r-trip-work); }
.trip-personal { --trip-c: var(--r-trip-personal); }
.trip-family { --trip-c: var(--r-trip-family); }
.trip-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; flex-shrink: 0;
  background: var(--trip-c, var(--r-text-tertiary)); box-shadow: 0 0 var(--r-glow-size) var(--trip-c, transparent); }
.trip-badge { background: var(--trip-c, var(--r-text-tertiary)); color: var(--r-canvas); font-weight: 500; }
.trip-away { border-color: color-mix(in srgb, var(--r-warning) 55%, transparent) !important; }
.trip-timeline { font-size: .75rem; }
.trip-tl-row { display: flex; align-items: center; gap: .5rem; height: 1.9rem; }
.trip-tl-head { height: 1.2rem; }
.trip-tl-name { width: 4.2rem; flex-shrink: 0; color: var(--r-text-secondary); }
.trip-tl-track { position: relative; flex-grow: 1; height: 100%; }
.trip-tl-week { position: absolute; top: 0; white-space: nowrap; color: var(--r-text-tertiary); }
.trip-tl-grid { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--r-border); }
.trip-tl-today { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--r-accent);
  box-shadow: 0 0 var(--r-glow-size) var(--r-accent); }
.trip-tl-bar { position: absolute; top: .3rem; bottom: .3rem; min-width: 6px; border-radius: .4rem; background: var(--trip-c, var(--r-text-tertiary));
  color: var(--r-canvas); text-decoration: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 .3rem; line-height: 1.3rem;
  box-shadow: 0 0 var(--r-glow-size) color-mix(in srgb, var(--trip-c, transparent) 60%, transparent); }
.trip-tl-bar:hover { color: var(--r-canvas); filter: brightness(1.1); }
.trip-item-icon { width: 2.2rem; height: 2.2rem; border-radius: .6rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; border: 1px solid var(--r-border); color: var(--r-accent-ink); background: var(--r-surface-sunken); }
.trip-tl-label { position: absolute; top: 0; line-height: 1.9rem; white-space: nowrap; pointer-events: none; color: var(--r-text); }

/* ============================================================ misc */
/* A sticky action bar (Cards: add ticked cards) sitting above the phone tab bar. */
.add-bar { bottom: calc(4.75rem + env(safe-area-inset-bottom)); margin-top: .75rem; padding: .6rem;
  border-radius: var(--r-radius-lg); border: 1px solid var(--r-border); background: var(--r-bar);
  -webkit-backdrop-filter: blur(var(--r-blur)); backdrop-filter: blur(var(--r-blur)); }
@media (min-width: 992px) { .add-bar { bottom: 1rem; } }
.install-prompt {
  position: fixed; left: 1rem; right: 1rem; bottom: calc(4.75rem + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-radius: var(--r-radius-lg);
  background: var(--r-surface-raised); color: var(--r-text); border: 1px solid var(--r-border); box-shadow: var(--r-shadow-2);
  font-size: .875rem; z-index: 1040;
}
@media (min-width: 992px) { .install-prompt { left: auto; width: 26rem; bottom: 1.5rem; } }
.text-body-secondary { color: var(--r-text-secondary) !important; }
.text-success { color: var(--r-success) !important; }
.text-danger { color: var(--r-danger) !important; }
.text-warning { color: var(--r-warning) !important; }

/* ============================================================ people */
.r-person { display: flex; gap: var(--r-space-3); padding: 14px 16px; align-items: flex-start; }
.r-person-body { flex: 1; min-width: 0; }
.r-person-more > summary { cursor: pointer; list-style: none; margin-top: 4px; }
.r-person-more > summary::-webkit-details-marker { display: none; }
.r-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; margin-left: 4px; border-radius: var(--r-radius-pill);
  font: 600 .6875rem/1 var(--r-font-sans); letter-spacing: .02em; vertical-align: 2px;
  background: var(--r-surface-sunken); color: var(--r-text-secondary); border: 1px solid var(--r-border); }
.r-badge-cue { background: color-mix(in srgb, var(--r-tile-tasks) 14%, var(--r-surface)); color: var(--r-text); }
.r-badge-ok { color: var(--r-success); border-color: color-mix(in srgb, var(--r-success) 40%, transparent); }
.r-badge-wait { color: var(--r-warning); border-color: color-mix(in srgb, var(--r-warning) 40%, transparent); }
/* Roadmap labels and idea statuses: the finished state reads as done, work in
   hand as in progress; the rest stay neutral. */
.roadmap-available, .idea-added { color: var(--r-success); border-color: color-mix(in srgb, var(--r-success) 40%, transparent); }
.roadmap-building, .idea-planned { color: var(--r-warning); border-color: color-mix(in srgb, var(--r-warning) 40%, transparent); }
.roadmap-item > span:first-child { min-width: 0; }
.roadmap-desc, .idea-context, .idea-text, .idea-reply { white-space: pre-line; overflow-wrap: anywhere; }

/* The Roadmap page: serif title, a thin gold thread down the left with a dot
   at each section, large app-style tiles, and an idea invitation at the end.
   The thread is decoration only - sections are headings, items are lists. */
.rm-head { margin: var(--r-space-2) 0 var(--r-space-6); }
.rm-title { margin: 0; font: 400 clamp(2rem, 11vw, 3.25rem)/1.05 var(--r-font-serif); letter-spacing: -.01em; overflow-wrap: break-word; }
.rm-intro { margin: 6px 0 0; font-size: 1.125rem; color: var(--r-text-secondary); }
.rm-thread { position: relative; }
.rm-section { padding-left: 30px; }
.rm-thread::before { content: ""; position: absolute; left: 6px; top: .6rem; bottom: 0; width: 1.5px;
  background: color-mix(in srgb, var(--r-accent) 70%, transparent); }
.rm-section + .rm-section { margin-top: var(--r-space-5); padding-top: var(--r-space-5); border-top: 1px solid var(--r-border); }
.rm-label { position: relative; margin: 0 0 var(--r-space-4); font: 600 .8125rem/1.3 var(--r-font-sans);
  letter-spacing: .14em; text-transform: uppercase; color: var(--r-accent-ink); }
.rm-label::before { content: ""; position: absolute; left: -30px; top: calc(.65em - 6px); width: 13.5px; height: 13.5px;
  border-radius: 50%; background: var(--r-accent); box-shadow: 0 0 0 4px var(--r-canvas); }
.rm-items { display: grid; gap: var(--r-space-5); margin: 0; padding: 0; list-style: none; }
/* Side by side while the words have room; with big text on a narrow phone
   the words go under the picture rather than breaking mid-word. */
.rm-item { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--r-space-3) var(--r-space-4); }
.rm-body { min-width: 0; flex: 1 1 11rem; }
/* The same finish as the Apps sheet's icons: filled, a soft top light, a
   hairline rim a shade lighter than the fill, and a shadow. */
.rm-tile.r-tile { width: clamp(60px, 19vw, 76px); height: clamp(60px, 19vw, 76px); border-radius: 24%;
  background-image: radial-gradient(120% 90% at 50% 0%, rgb(255 255 255 / .10), transparent 70%);
  background-color: var(--t-bg);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--t-bg) 84%, var(--r-text)), inset 0 2px 0 rgb(255 255 255 / .06),
    0 12px 20px -12px rgb(0 0 0 / .6); }
.rm-tile .r-icon { width: 50%; height: 50%; stroke-width: 1.5; }
[data-theme="light"] .rm-tile.r-tile { box-shadow: inset 0 0 0 1px rgb(42 35 28 / .10), inset 0 1px 0 rgb(255 255 255 / .18),
  0 10px 18px -10px rgb(42 35 28 / .45); }
[data-theme="light"] .rm-tile.r-tile:is(.t-trips, .t-inbox, .t-ask, .t-realm) {
  background-color: color-mix(in srgb, var(--t-bg) 82%, var(--r-tile-ask-ink)); }
[data-theme="midnight"] .rm-tile.r-tile {
  background: linear-gradient(var(--t-bg), var(--t-bg)) padding-box, var(--t-ring) border-box; box-shadow: var(--r-tile-shadow); }
.rm-name { margin: 0; font: 400 1.375rem/1.15 var(--r-font-serif); overflow-wrap: break-word; }
.rm-desc { margin: 4px 0 10px; font-size: .9375rem; line-height: 1.4; color: var(--r-text-secondary); }
/* Status: a quiet filled pill in the matching app colour. */
.rm-status { --b-bg: var(--r-tile-subscriptions); --b-ink: var(--r-tile-subscriptions-ink);
  display: inline-flex; align-items: center; min-height: 24px; padding: 3px 16px; margin-right: 6px; border-radius: var(--r-radius-pill);
  background: var(--b-bg); color: var(--b-ink); border: 1px solid color-mix(in srgb, var(--b-ink) 22%, transparent);
  font: 600 .6875rem/1.2 var(--r-font-sans); letter-spacing: .16em; text-transform: uppercase; }
.rm-available { --b-bg: var(--r-tile-tasks); --b-ink: var(--r-tile-tasks-ink); }
.rm-building { --b-bg: var(--r-tile-cards); --b-ink: var(--r-tile-cards-ink); }
.rm-planned { --b-bg: var(--r-tile-recipes); --b-ink: var(--r-tile-recipes-ink); }
.rm-hidden { --b-bg: transparent; --b-ink: var(--r-text-tertiary); }
.rm-empty { margin: 0; padding: var(--r-space-6) 0; color: var(--r-text-secondary); }
.rm-invite { display: flex; align-items: flex-start; gap: var(--r-space-4); margin-top: var(--r-space-8, 40px);
  padding: 22px 20px; border: 1px solid var(--r-border); border-radius: var(--r-radius-lg);
  background: color-mix(in srgb, var(--r-tile-tasks) 22%, var(--r-surface)); }
[data-theme="light"] .rm-invite { background: color-mix(in srgb, var(--r-tile-tasks) 9%, var(--r-surface)); }
.rm-invite-icon.r-icon { width: 44px; height: 44px; color: var(--r-accent); }
.rm-invite-body { min-width: 0; flex: 1; }
.rm-invite-title { margin: 0; font: 400 1.625rem/1.15 var(--r-font-serif); }
.rm-invite-body p { margin: 4px 0 var(--r-space-4); color: var(--r-text-secondary); }
.rm-invite-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 48px; }
.rm-links { margin-top: var(--r-space-6); }
/* Edit the roadmap: each section's items in order, with up/down nudges. */
.rm-order { list-style: none; padding: 0; }
.rm-order-row { display: flex; align-items: center; gap: var(--r-space-2); padding: 8px 12px; }
.rm-order-row + .rm-order-row { border-top: 1px solid var(--r-border); }
.rm-order-n { flex: 0 0 1.5rem; color: var(--r-text-tertiary); font-variant-numeric: tabular-nums; }
.rm-order-link { flex: 1; min-width: 0; color: var(--r-text); text-decoration: none; overflow-wrap: anywhere; }
.rm-move-up .r-icon { transform: rotate(180deg); }
.rm-move { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; }
/* Gold, as the mockup has it (Midnight keeps its own gradient button). */
:is([data-theme="light"], [data-theme="dark"]) .rm-invite-btn.btn-primary {
  --bs-btn-bg: var(--r-accent); --bs-btn-border-color: var(--r-accent); --bs-btn-color: var(--r-tile-cards);
  --bs-btn-hover-bg: var(--r-mark); --bs-btn-hover-border-color: var(--r-mark); --bs-btn-hover-color: var(--r-tile-cards);
  --bs-btn-active-bg: var(--r-accent); --bs-btn-active-color: var(--r-tile-cards); }
@media (max-width: 359.98px) { .rm-invite { flex-direction: column; } }
.idea-reply { padding: var(--r-space-2) var(--r-space-3); border-radius: var(--r-radius-sm, 8px); background: var(--r-surface-sunken); }
.r-choice-list { display: grid; gap: 6px; }
.r-choice-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--r-border);
  border-radius: var(--r-radius-md); background: var(--r-surface-raised); cursor: pointer; }
.r-choice-row:has(input:checked) { border-color: var(--r-accent); box-shadow: 0 0 0 1px var(--r-accent); }
.r-choice-row .form-check-input { margin-top: 3px; flex: 0 0 auto; }
.r-access th[scope="row"] { font-weight: 400; }
.r-access thead th { font-weight: 500; border-bottom-color: var(--r-border); }

/* ============================================================ Lists & tags */
.r-org-summary { display: flex; align-items: center; gap: var(--r-space-3); padding: 12px 16px; min-height: 52px; }
.org-row > summary.r-org-summary { cursor: pointer; }
.r-org-body { padding: 0 16px 14px 42px; }
@media (max-width: 575.98px) { .r-org-body { padding-left: 16px; } }
.r-grow { min-width: min(12rem, 100%); }
.r-main .form-select.w-auto { max-width: 100%; }
.r-grow-sm { min-width: min(9rem, 100%); }
.org-chevron { transition: transform var(--r-dur-2) var(--r-ease); }

/* Flight export */
.r-export { max-width: 46rem; display: grid; gap: var(--r-space-4); }
.r-choice-inline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .r-choice-inline { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.r-export-preview { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8125rem; white-space: pre;
  overflow: auto; max-height: 16rem; resize: vertical; background: var(--r-surface-sunken); color: var(--r-text); }
.r-status:empty { display: none; }
.r-status { color: var(--r-success, var(--r-text)); font-weight: 500; margin-bottom: var(--r-space-2); }

/* CUE filter: one button, removable chips, a panel (dropdown on desktop, bottom sheet on a phone) */
.r-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--r-space-2); }
.r-filter-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: var(--r-radius-pill); border: 1px solid var(--r-border); background: var(--r-surface);
  color: var(--r-text); font-weight: 500; font-size: .875rem; }
.r-filter-btn:hover, .r-filter-btn[aria-expanded="true"] { border-color: var(--r-border-strong); }
.r-filter-btn.on { border-color: var(--r-accent); }
.r-filter-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-radius-pill); display: inline-grid;
  place-items: center; background: var(--r-accent); color: var(--r-canvas); font-size: .75rem;
  font-variant-numeric: tabular-nums; }
.r-filter-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px 0 12px;
  border-radius: var(--r-radius-pill); text-decoration: none; font-size: .875rem; font-weight: 500;
  color: var(--tag); background: color-mix(in srgb, var(--tag) var(--r-tag-tint), transparent);
  border: 1px solid color-mix(in srgb, var(--tag) 35%, transparent); max-width: 100%; }
.r-filter-chip .r-swatch { width: 7px; height: 7px; border-radius: 50%; background: var(--tag); flex: 0 0 auto; }
.r-filter-chip .r-icon:last-child { opacity: .7; }
.r-filter-chip:hover .r-icon:last-child { opacity: 1; }
.r-filter-clear { font-size: .8125rem; color: var(--r-text-secondary); padding: 8px 4px; }
.r-filter-panel { width: min(22rem, calc(100vw - 32px)); padding: 0; overflow: hidden;
  border: 1px solid var(--r-border); border-radius: var(--r-radius-lg); background: var(--r-surface-raised);
  box-shadow: var(--r-shadow-2, var(--r-shadow-1)); }
.r-filter-head { padding: var(--r-space-3) var(--r-space-3) var(--r-space-2); border-bottom: 1px solid var(--r-border); }
.r-filter-search { position: relative; }
.r-filter-search .r-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--r-text-tertiary); }
.r-filter-search input { padding-left: 32px; min-height: 38px; }
.r-filter-body { max-height: min(60vh, 26rem); overflow-y: auto; overscroll-behavior: contain; padding: var(--r-space-2) 0; }
.r-filter-section + .r-filter-section { margin-top: var(--r-space-2); }
.r-filter-section .r-label { padding: 4px var(--r-space-3); margin: 0; }
.r-filter-opt { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px var(--r-space-3); color: var(--r-text); }
.r-filter-opt .r-swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--tag); flex: 0 0 auto; }
.r-filter-opt > .r-icon:first-child { color: var(--tag); }
.r-filter-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-filter-opt[aria-current="true"] { background: color-mix(in srgb, var(--tag) var(--r-tag-tint), transparent); font-weight: 600; }
.r-filter-tick { color: var(--r-accent); display: inline-flex; }
.r-filter-none { padding: var(--r-space-2) var(--r-space-3); margin: 0; }
.r-filter-foot { display: flex; justify-content: space-between; gap: var(--r-space-3); padding: var(--r-space-2) var(--r-space-3);
  border-top: 1px solid var(--r-border); font-size: .8125rem; }
.r-filter-foot a { color: var(--r-text-secondary); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.r-filter-foot a:hover { color: var(--r-text); }
@media (max-width: 991.98px) {
  /* A bottom sheet, in thumb reach. !important beats Popper's inline placement. */
  .r-filter-panel.show { position: fixed !important; inset: auto 0 0 0 !important; transform: none !important; width: auto;
    margin: 0 !important; border-radius: var(--r-radius-xl) var(--r-radius-xl) 0 0; z-index: 1050;
    padding-bottom: env(safe-area-inset-bottom); }
  .r-filter-panel.show { box-shadow: 0 0 0 100vmax color-mix(in srgb, var(--r-canvas) 55%, transparent); }
  /* The sheet takes the bottom of the screen, as the More sheet does. */
  body:has(.r-filter-panel.show) .r-tabbar { visibility: hidden; }
  .r-filter-panel .r-grab { display: block; margin: 0 auto var(--r-space-2); }
  .r-filter-opt { min-height: 46px; }
  .r-filter-body { max-height: 55vh; max-height: 55dvh; }
}

/* Trip history */
.r-history-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--r-space-2); align-items: end; max-width: 46rem; }
.r-history-q, .r-history-go { grid-column: 1 / -1; }
@media (min-width: 768px) { .r-history-filters { grid-template-columns: 9rem 10rem minmax(0, 1fr) auto; }
  .r-history-q, .r-history-go { grid-column: auto; } }
.r-history-year { font-family: var(--r-font-serif); font-size: 1.5rem; margin: var(--r-space-4) 0 var(--r-space-2); }

/* Month calendar: a grid of days; trips as bars on the days they cover */
.r-month-nav { display: flex; gap: var(--r-space-2); flex-wrap: wrap; }
.r-month { border: 1px solid var(--r-border); border-radius: var(--r-radius-lg); overflow: hidden; background: var(--r-surface); }
.r-month-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.r-month-head div { padding: 6px; font-size: .75rem; color: var(--r-text-tertiary); text-align: center; border-bottom: 1px solid var(--r-border); }
.r-month-day { min-height: 6.5rem; padding: 4px; border-right: 1px solid var(--r-border); border-bottom: 1px solid var(--r-border);
  display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.r-month-row > .r-month-day:last-child { border-right: 0; }
.r-month-row:last-child > .r-month-day { border-bottom: 0; }
.r-month-day.out { background: var(--r-surface-sunken); }
.r-month-day.out .r-month-num { color: var(--r-text-tertiary); }
.r-month-num { font-size: .75rem; font-variant-numeric: tabular-nums; color: var(--r-text-secondary); width: 1.6rem; height: 1.6rem;
  display: grid; place-items: center; border-radius: 50%; }
.r-month-day.today .r-month-num { background: var(--r-accent); color: var(--r-canvas); font-weight: 600; }
.r-month-trip { display: block; font-size: .7rem; line-height: 1.2; padding: 2px 5px; border-radius: 4px; color: var(--r-canvas);
  background: var(--trip-c, var(--r-text-tertiary)); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-month-trip:not(.starts) { color: transparent; }
.r-month-more { font-size: .7rem; color: var(--r-text-tertiary); }
@media (max-width: 767.98px) {
  /* Phones: a compact grid of days with coloured bars; the list below has the details. */
  .r-month-day { min-height: 3.4rem; padding: 2px; }
  .r-month-trip { font-size: 0; height: 5px; padding: 0; border-radius: 3px; }
  .r-month-head div { font-size: .6875rem; padding: 4px 0; }
}

/* Account: the iPhone set-up checklist */
.r-setup-step { display: flex; align-items: center; gap: var(--r-space-3); padding: var(--r-space-3) var(--r-space-4);
  color: var(--r-text); text-decoration: none; }
.r-setup-step + .r-setup-step { border-top: 1px solid var(--r-border); }
a.r-setup-step:hover { background: var(--r-surface-sunken); }
.r-setup-mark { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--r-border-strong); color: var(--r-text-secondary); font-size: .8125rem; font-weight: 600; }
.r-setup-mark.done { background: var(--r-success); border-color: var(--r-success); color: var(--r-canvas); }
.r-setup-body { flex: 1 1 auto; min-width: 0; }
.r-setup-state { font-size: .8125rem; color: var(--r-text-secondary); white-space: nowrap; }

/* Expenses */
.r-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--r-space-2); }
@media (min-width: 768px) { .r-stats { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); } }
.r-stat { display: flex; flex-direction: column; gap: 4px; padding: var(--r-space-3); border: 1px solid var(--r-border);
  border-radius: var(--r-radius-md); background: var(--r-surface); color: var(--r-text); text-decoration: none; min-width: 0; }
a.r-stat:hover { border-color: var(--r-border-strong); }
.r-stat .r-label { margin: 0; }
.r-stat-num { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.r-row { display: flex; align-items: center; justify-content: space-between; gap: var(--r-space-3);
  padding: var(--r-space-3) var(--r-space-4); color: var(--r-text); text-decoration: none; }
.r-row + .r-row { border-top: 1px solid var(--r-border); }
a.r-row:hover { background: var(--r-surface-sunken); }
.r-row > span:first-child { min-width: 0; }
.r-row-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-row.muted, .r-txn.muted { opacity: .62; }
.r-chiprow { display: flex; gap: var(--r-space-2); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.r-chiprow::-webkit-scrollbar { display: none; }
.r-viewchip { flex: 0 0 auto; min-height: 34px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: var(--r-radius-pill);
  border: 1px solid var(--r-border); color: var(--r-text-secondary); text-decoration: none; font-size: .8125rem; font-weight: 500; white-space: nowrap; }
.r-viewchip.on { border-color: var(--r-accent); color: var(--r-text); background: var(--r-surface); }
.r-filters > summary { list-style: none; display: inline-flex; cursor: pointer; }
.r-filters > summary::-webkit-details-marker { display: none; }
.r-filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--r-space-2); align-items: end;
  padding: var(--r-space-3); border: 1px solid var(--r-border); border-radius: var(--r-radius-md); background: var(--r-surface); }
.r-filter-wide, .r-filter-go { grid-column: 1 / -1; }
@media (min-width: 992px) { .r-filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .r-filter-wide { grid-column: span 2; } .r-filter-go { grid-column: auto; } }
.r-txn { display: flex; align-items: flex-start; gap: var(--r-space-3); padding: var(--r-space-3) var(--r-space-4); }
.r-txn + .r-txn { border-top: 1px solid var(--r-border); }
.r-txn > .form-check-input { margin-top: 4px; flex: 0 0 auto; }
.r-txn-body { flex: 1 1 auto; min-width: 0; color: var(--r-text); text-decoration: none; display: block; }
.r-txn-main { display: flex; justify-content: space-between; gap: var(--r-space-3); }
.r-txn-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-txn-amt { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.r-txn-amt.in { color: var(--r-success); }
.r-txn-meta { display: block; overflow-wrap: anywhere; }
.r-todo { color: var(--r-warning); font-weight: 500; }
.r-bulkbar { display: flex; flex-wrap: wrap; gap: var(--r-space-2); align-items: center; padding: var(--r-space-2);
  border: 1px solid var(--r-border); border-radius: var(--r-radius-md); background: var(--r-surface); position: sticky; z-index: 5;
  /* Above the phone tab bar, which grows by the home-indicator strip on an iPhone. */
  bottom: calc(84px + env(safe-area-inset-bottom)); box-shadow: var(--r-shadow-1); }
@media (min-width: 992px) { .r-bulkbar { bottom: var(--r-space-3); } }
.r-bulkbar .form-select { width: auto; flex: 1 1 9rem; }
.r-part { border: 1px solid var(--r-border); border-radius: var(--r-radius-md); padding: var(--r-space-3); margin-bottom: var(--r-space-2); }
.r-part-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--r-space-2); }
.r-part-amt, .r-part-note { grid-column: 1 / -1; }
@media (min-width: 576px) { .r-part-row { grid-template-columns: 7.5rem minmax(0, 1fr) 8.5rem; } .r-part-amt { grid-column: auto; } }
.r-part-more summary { color: var(--r-text-secondary); margin-top: var(--r-space-2); cursor: pointer; }
.r-raw { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px var(--r-space-3); font-size: .8125rem; margin: 0 0 var(--r-space-2); }
.r-raw dt { color: var(--r-text-secondary); font-weight: 500; }
.r-raw dd { margin: 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.r-scroll { overflow-x: auto; max-width: 100%; border: 1px solid var(--r-border); border-radius: var(--r-radius-md); }
.r-table { margin: 0; font-size: .8125rem; }
.r-table th, .r-table td { white-space: nowrap; }
.r-table td:nth-child(2) { white-space: normal; min-width: 12rem; }
.r-cat-edit summary { color: var(--r-text-secondary); cursor: pointer; }
.r-cat { flex-wrap: wrap; }
@media (max-width: 575.98px) { .r-part-extra { grid-template-columns: minmax(0, 1fr); } }
.r-recur { flex-wrap: wrap; }
.r-recur-main { flex: 1 1 16rem; min-width: 0; color: var(--r-text); text-decoration: none; }
.r-bar-row { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; gap: 4px var(--r-space-3); align-items: center;
  padding: var(--r-space-2) var(--r-space-4); }
.r-bar-row + .r-bar-row { border-top: 1px solid var(--r-border); }
.r-bar-label { color: var(--r-text-secondary); font-size: .8125rem; }
.r-bar-track { height: 8px; border-radius: 4px; background: var(--r-surface-sunken); overflow: hidden; }
.r-bar { display: block; height: 100%; background: var(--r-accent); border-radius: 4px; }
.r-bar-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-bar-split { grid-column: 2 / -1; }

.r-tile.t-bar { --t-bg: var(--r-tile-bar); --t-ink: var(--r-tile-bar-ink); --t-ring: var(--r-tile-cards-ring, var(--t-bg)); }

/* Running uses REALM’s existing blue-grey app material in every theme. */
.r-tile.t-running { --t-bg: var(--r-tile-subscriptions); --t-ink: var(--r-tile-subscriptions-ink); --t-ring: var(--r-tile-subscriptions-ring, var(--t-bg)); }
