/* ========================================================================== 
   Rental Billing System — Global UI CSS
   Load this file AFTER Tailwind.
   Supports ui-guidelines-v2.md and ui-tailwind-patterns.md.
   ========================================================================== */

:root {
  /* Layout breakpoints (use these values in @media — CSS vars are not valid in media queries):
     Desktop nav: min-width 1024px
     Tablet/mobile nav (hamburger drawer): max-width 1023px
     Compact phone padding: max-width 640px */
  --rb-breakpoint-desktop: 1024px;
  --rb-sidebar-width-fixed: 256px;
  --rb-drawer-width: min(320px, 88vw);
  --rb-nav-z-backdrop: 50;
  --rb-nav-z-drawer: 60;
  --rb-nav-z-topbar: 45;
  --rb-bg: #f7f9fb;
  --rb-surface: #ffffff;
  --rb-border: #e6eaf0;
  --rb-divider: #eef1f5;

  --rb-text-primary: #0f172a;
  --rb-text-secondary: #6b7280;
  --rb-text-muted: #9ca3af;

  --rb-teal: #1f9d8d;
  --rb-teal-hover: #17897a;
  --rb-teal-light: #e6f4f2;

  --rb-success: #22c55e;
  --rb-success-bg: #eaf7ef;
  --rb-warning: #f59e0b;
  --rb-warning-bg: #fef3e6;
  --rb-danger: #ef4444;
  --rb-danger-bg: #fdecec;
  --rb-info: #3b82f6;
  --rb-info-bg: #eaf2ff;

  --rb-radius-input: 8px;
  --rb-radius-card: 12px;
  --rb-radius-modal: 16px;
  --rb-radius-pill: 999px;

  --rb-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04);
  --rb-shadow-modal: 0 10px 30px rgba(0, 0, 0, 0.08);

  --rb-font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --rb-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --rb-content-max: 1200px;
  --rb-sidebar-width: var(--rb-sidebar-width-fixed);
  --rb-page-pad-x: 32px;
  --rb-page-pad-y: 32px;
}

html {
  background: var(--rb-bg);
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--rb-bg);
  color: var(--rb-text-primary);
  font-family: var(--rb-font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.rb-page-shell {
  max-width: var(--rb-content-max);
  margin-inline: auto;
  padding: var(--rb-page-pad-y) var(--rb-page-pad-x);
  box-sizing: border-box;
  width: 100%;
  overflow-x: clip;
}
.rb-content-max { max-width: var(--rb-content-max); }
.rb-sidebar {
  display: flex;
  flex-direction: column;
  width: var(--rb-sidebar-width);
  height: 100vh;
  overflow: hidden;
  background: #09090b;
  color: #f4f4f5;
  font-size: 14px;
  line-height: 1.35;
}
.rb-sidebar--desktop {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
}
.rb-main-with-sidebar { margin-left: var(--rb-sidebar-width); min-height: 100vh; }
.rb-sidebar-sticky { position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto; }

/* Typography */
.rb-page-title { color: var(--rb-text-primary); font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.rb-page-subtitle { margin-top: 4px; color: var(--rb-text-secondary); font-size: 14px; line-height: 20px; }
.rb-section-title { color: var(--rb-text-primary); font-size: 16px; line-height: 24px; font-weight: 600; }
.rb-section-subtitle { margin-top: 4px; color: var(--rb-text-secondary); font-size: 14px; line-height: 20px; }
.rb-label { color: #475569; font-size: 14px; line-height: 20px; font-weight: 500; }
.rb-eyebrow { color: #64748b; font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }

/* Numbers */
.font-display-number,
.rb-display-number {
  font-family: var(--rb-font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.font-ui-number,
.rb-ui-number {
  font-family: var(--rb-font-mono);
  font-variant-numeric: tabular-nums;
}
.rb-no-wrap-number { white-space: nowrap; }
.rb-money-positive { color: #047857; }
.rb-money-warning { color: #b45309; }
.rb-money-danger { color: var(--rb-danger); }
.rb-account-balance-owed {
  font-weight: 700;
  color: #b91c1c;
}
.rb-account-balance-credit {
  font-weight: 700;
  color: #047857;
}
.rb-account-balance-settled {
  font-weight: 500;
  color: var(--rb-text-secondary, #64748b);
}
.rb-payment-history-voided td {
  opacity: 0.78;
}
.rb-money-muted { color: var(--rb-text-secondary); }

/* Cards */
.rb-card { border: 1px solid var(--rb-border); border-radius: var(--rb-radius-card); background: var(--rb-surface); box-shadow: var(--rb-shadow-card); }
.rb-card-pad { padding: 20px; }
.rb-section-card { overflow: hidden; border: 1px solid var(--rb-border); border-radius: var(--rb-radius-card); background: var(--rb-surface); box-shadow: var(--rb-shadow-card); }
.rb-section-card-header { border-bottom: 1px solid var(--rb-divider); padding: 16px 20px; }
.rb-section-card-header-row,
.rb-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
}
.rb-section-card-header-row .rb-section-card-header-text {
  min-width: 0;
  flex: 1 1 12rem;
}
.rb-section-card-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.rb-section-card--stack {
  margin-bottom: 24px;
}
.rb-section-card-body { padding: 20px; }

/* Tenant detail/edit — minimal scoped layout helpers */
.rb-tenant-grid {
  display: grid;
  gap: 16px;
}
@media (min-width: 1024px) {
  .rb-tenant-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.rb-tenant-metrics {
  display: grid;
  gap: 16px;
}
@media (min-width: 640px) {
  .rb-tenant-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.rb-tenant-dl {
  padding: 20px;
  display: grid;
  gap: 12px;
}
.rb-tenant-dl dt {
  color: #64748b;
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.rb-tenant-dl dd {
  margin: 4px 0 0;
  color: var(--rb-text-primary);
}

/* Tenant ledger — scoped disclosure styling (no Tailwind dependency) */
.rb-tenant-ledger-desc {
  min-width: 0;
  word-break: break-word;
}
.rb-tenant-ledger-details {
  margin-top: 8px;
}
.rb-tenant-ledger-summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--rb-teal);
}
.rb-tenant-ledger-summary:hover {
  color: var(--rb-teal-hover);
  text-decoration: underline;
}
.rb-tenant-ledger-detail-list {
  margin: 10px 0 0;
  padding: 0 0 0 12px;
  border-left: 2px solid var(--rb-divider);
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
}
.rb-tenant-ledger-alloc-list {
  border-left-color: #bbf7d0;
}
.rb-tenant-ledger-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.rb-tenant-ledger-detail-left {
  min-width: 0;
}
.rb-tenant-ledger-detail-right {
  flex-shrink: 0;
  color: var(--rb-text-primary);
}

.rb-metric-card { border: 1px solid var(--rb-border); border-radius: var(--rb-radius-card); background: var(--rb-surface); box-shadow: var(--rb-shadow-card); padding: 20px; }
.rb-metric-label { color: #64748b; font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.rb-metric-value { margin-top: 8px; color: var(--rb-text-primary); font-family: var(--rb-font-mono); font-size: 32px; line-height: 40px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rb-metric-helper { margin-top: 4px; color: var(--rb-text-secondary); font-size: 14px; line-height: 20px; }

/* Stat tiles (counts / currency-style amounts — mono tabular via .rb-ui-number when combined) */
.rb-stat-number {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 600;
  line-height: 36px;
  color: var(--rb-text-primary);
  font-variant-numeric: tabular-nums;
}
.rb-stat-number-money {
  font-family: var(--rb-font-mono);
  letter-spacing: -0.02em;
}

/* Buttons */
/* App controls — match Enter Readings / period toolbar (40px fields, 40px buttons) */
.rb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: var(--rb-radius-input);
  padding: 10px 16px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
  cursor: pointer;
  box-sizing: border-box;
  white-space: nowrap;
  text-overflow: clip;
  overflow: visible;
  max-width: 100%;
}
.rb-btn:disabled, .rb-btn[aria-disabled="true"] { cursor: not-allowed; opacity: 0.55; }
.rb-btn-primary { border: 1px solid transparent; background: var(--rb-teal); color: white; box-shadow: var(--rb-shadow-card); }
.rb-btn-primary:hover { background: var(--rb-teal-hover); }
.rb-btn-primary:focus { outline: 2px solid rgba(31, 157, 141, 0.25); outline-offset: 2px; }
/* Bottom primary CTAs on Enter Readings / Review Readings / Post Invoices only */
.rb-billing-flow-bottom-cta {
  display: flex;
  justify-content: flex-end;
  margin-top: 32px;
  padding-top: 8px;
}
.rb-billing-flow-bottom-cta .rb-btn-billing-cta {
  min-height: 48px;
  padding: 12px 28px;
  font-size: 16px;
  line-height: 24px;
}
.rb-btn-secondary { border: 1px solid transparent; background: #f1f5f9; color: var(--rb-text-primary); }
.rb-btn-secondary:hover { background: #e2e8f0; }
/* Deprecated: same as secondary (no outline stroke) */
.rb-btn-outline {
  border: 1px solid transparent;
  background: #f1f5f9;
  color: var(--rb-text-primary);
}
.rb-btn-outline:hover { background: #e2e8f0; }
.rb-btn-ghost {
  border: 1px solid transparent;
  background: #f1f5f9;
  color: var(--rb-text-primary);
}
.rb-btn-ghost:hover { background: #e2e8f0; }
.rb-btn-label-wrap {
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}
.rb-btn-warning { border: 1px solid transparent; background: var(--rb-warning); color: white; box-shadow: var(--rb-shadow-card); }
.rb-btn-warning:hover { background: #d97706; }
.rb-btn-danger { border: 1px solid transparent; background: var(--rb-danger); color: white; box-shadow: var(--rb-shadow-card); }
.rb-btn-danger:hover { background: #dc2626; }
.rb-btn-sm,
.rb-btn-small {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 12px;
  line-height: 16px;
}

/* Hardened defaults: buttons without .rb-btn* inside main UI (sidebar excluded — it is outside .rb-page-shell). */
.rb-page-shell button:not([class*="rb-btn"]):not(.rb-icon-btn):not([class*="insert-token"]):not([class*="preview-tab"]):not([class*="rb-segment"]):not(.rb-review-warn-btn),
.rb-section-card button:not([class*="rb-btn"]):not(.rb-icon-btn):not([class*="insert-token"]):not([class*="preview-tab"]):not([class*="rb-segment"]):not(.rb-review-warn-btn),
.rb-table-shell button:not([class*="rb-btn"]):not(.rb-icon-btn):not(.rb-review-warn-btn),
.rb-modal button:not([class*="rb-btn"]):not(.rb-icon-btn):not([class*="insert-token"]):not([class*="preview-tab"]):not([class*="rb-segment"]):not(.rb-review-warn-btn),
.rb-doc-preview-actions button:not([class*="rb-btn"]):not(.rb-icon-btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: var(--rb-radius-input);
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: var(--rb-text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: var(--rb-shadow-card);
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.rb-page-shell button:not([class*="rb-btn"]):not(.rb-icon-btn):not([class*="rb-segment"]):not(.rb-review-warn-btn):not([disabled]):hover,
.rb-section-card button:not([class*="rb-btn"]):not(.rb-icon-btn):not([class*="rb-segment"]):not(.rb-review-warn-btn):not([disabled]):hover,
.rb-table-shell button:not([class*="rb-btn"]):not(.rb-icon-btn):not(.rb-review-warn-btn):not([disabled]):hover,
.rb-modal button:not([class*="rb-btn"]):not(.rb-icon-btn):not([class*="rb-segment"]):not(.rb-review-warn-btn):not([disabled]):hover,
.rb-doc-preview-actions button:not([class*="rb-btn"]):not(.rb-icon-btn):not([disabled]):hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.rb-small-link {
  display: inline;
  font-size: 13px;
  font-weight: 600;
  color: var(--rb-teal);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
.rb-small-link:hover {
  text-decoration: underline;
  color: var(--rb-teal-hover);
}

.rb-clickable-row {
  cursor: pointer;
}
.rb-clickable-row:hover {
  background: #f1f5f9 !important;
}
.rb-clickable-row:focus-visible {
  outline: 2px solid rgba(31, 157, 141, 0.45);
  outline-offset: -2px;
}
tbody.is-clickable .rb-clickable-row {
  text-decoration: none;
}

/* Lots (Units & Meters): no hover/focus accent on collapsed rows; expanded row only subtle fill */
.rb-um-lot-summary.rb-clickable-row:hover {
  background: transparent !important;
}
.rb-um-lot-summary.rb-clickable-row:focus-visible {
  outline: 2px solid var(--rb-border);
  outline-offset: 2px;
}
.rb-um-lot-summary.is-expanded {
  background: #f8fafc;
}
.rb-um-lot-summary.is-expanded:hover {
  background: #f8fafc !important;
}

/* Units & Meters: list rows (no bullets) */
.rb-um-unit-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rb-um-unit-row {
  padding: 16px 20px;
  border-top: 1px solid var(--rb-divider);
}
.rb-um-unit-row:first-child {
  border-top: none;
}
.rb-um-unit-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}
.rb-um-meter-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.rb-um-muted-block {
  max-width: 16rem;
  font-size: 12px;
  line-height: 1.45;
  color: var(--rb-text-secondary);
}
.rb-um-unit-row.is-inactive {
  background: #f8fafc;
  color: var(--rb-text-secondary);
}
.rb-um-unit-row-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
}
.rb-um-unit-main {
  min-width: 0;
  flex: 1;
}
.rb-um-unit-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 600;
}
.rb-um-occupancy {
  font-size: 14px;
  margin: 0 0 8px;
}
.rb-um-occupancy-label {
  color: var(--rb-text-secondary);
}
.rb-um-meter-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rb-um-add-meter-wrap {
  margin-top: 10px;
}
.rb-um-label-form {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rb-label-compact {
  font-size: 12px;
}
.rb-um-inline-form {
  display: inline;
}
.rb-um-meter-icon-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}
.rb-um-empty {
  text-align: center;
  padding: 32px;
}
.rb-um-meter-name-cell {
  font-weight: 600;
}
.rb-um-last-read-cell {
  font-size: 13px;
}
.rb-um-meter-active-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.rb-checkbox-row--compact {
  padding: 6px 10px;
  margin: 0;
  align-items: center;
  gap: 8px;
}
.rb-um-active-label {
  font-size: 13px;
}
.rb-um-table-empty {
  text-align: center;
  padding: 24px;
}
.rb-um-lot-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--rb-text-primary);
}
.rb-um-meters-table .rb-um-active-cell {
  text-align: center;
  vertical-align: middle;
}
.rb-um-meters-table .rb-um-meter-active-form {
  justify-content: flex-start;
  width: auto;
}
.rb-um-meter-chevron-col {
  width: 44px;
  text-align: center;
  vertical-align: middle;
}
.rb-um-meter-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: transform 150ms ease;
}
.rb-um-meter-summary.is-expanded .rb-um-meter-chevron {
  transform: rotate(180deg);
}
.rb-um-meter-detail-cell {
  background: #f8fafc;
  padding: 0 !important;
  vertical-align: top;
}
.rb-um-meter-detail-inner {
  padding: 16px 20px;
}
.rb-um-meter-detail-dl {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 20px;
  margin: 0 0 16px;
}
.rb-um-meter-detail-dl dt {
  font-size: 12px;
  font-weight: 600;
  color: var(--rb-text-secondary);
  margin: 0;
}
.rb-um-meter-detail-dl dd {
  margin: 4px 0 0;
  font-size: 14px;
  word-break: break-word;
}
.rb-um-meter-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.rb-um-lot-summary-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}
.rb-um-lot-chevron-wrap {
  flex-shrink: 0;
  padding-top: 4px;
  color: #64748b;
}
.rb-um-lot-chevron {
  display: inline-flex;
  transition: transform 150ms ease;
}
.rb-um-lot-summary.is-expanded .rb-um-lot-chevron {
  transform: rotate(180deg);
}
.rb-um-lot-detail {
  padding: 0 0 16px;
  margin: 0;
}
.rb-um-lot-meters-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}
.rb-um-lot-meter-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.rb-um-lot-meters-empty {
  margin: 0;
  font-size: 14px;
}
.rb-ir-actions-cell {
  text-align: center;
  vertical-align: middle;
}
.rb-ir-icon-pair {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.rb-ir-icon-pair a.rb-icon-btn {
  text-decoration: none;
}
.rb-um-tooltip-wrap {
  display: inline-block;
  max-width: 100%;
}
.rb-um-tooltip-wrap[title] {
  cursor: help;
}
.rb-um-tooltip-wrap[tabindex]:focus-visible {
  outline: 2px solid rgba(31, 157, 141, 0.45);
  outline-offset: 2px;
  border-radius: 4px;
}
.rb-um-tooltip-wrap .rb-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.rb-um-modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rb-modal-header-tight {
  flex-shrink: 0;
}
.rb-label-optional {
  font-weight: 400;
}
.rb-um-view-latest {
  margin: 0;
}
.rb-um-view-latest-val {
  font-weight: 600;
  color: var(--rb-text-primary);
}
.rb-um-flash {
  margin-bottom: 12px;
}
.rb-um-toolbar {
  margin-bottom: 20px;
}
.rb-um-banner {
  margin-bottom: 20px;
}
.rb-um-banner-title {
  margin: 0;
  font-weight: 600;
}
.rb-um-banner-sub {
  margin-top: 8px;
  margin-bottom: 0;
}
.rb-um-meters-table-shell {
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.rb-um-meter-line.is-muted {
  opacity: 0.85;
}
.rb-um-label-details {
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-input);
  background: #f8fafc;
  padding: 10px 12px;
}
.rb-um-label-details > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--rb-teal);
  list-style: none;
}
.rb-um-label-details > summary::-webkit-details-marker {
  display: none;
}
.rb-table-shell--nested {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  box-shadow: none;
}
.rb-table tbody tr.is-inactive {
  background: #f8fafc;
}
.rb-preview-email-meta {
  font-size: 12px;
  color: var(--rb-text-secondary);
  margin: 0 0 6px;
}
.rb-preview-email-meta strong {
  color: var(--rb-text-primary);
  font-weight: 600;
}
.rb-preview-email-divider {
  border: none;
  border-top: 1px solid var(--rb-divider);
  margin: 12px 0;
}

/* Table / card checkboxes — consistent sizing (main content only) */
.rb-page-shell .rb-section-card input[type="checkbox"],
.rb-table-shell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--rb-teal);
  cursor: pointer;
  flex-shrink: 0;
}

.rb-notifications-layout {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 1024px) {
  .rb-notifications-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .rb-notifications-aside {
    position: sticky;
    top: 24px;
    margin-top: 0;
  }
}
.rb-notifications-aside {
  margin-top: 24px;
}
.rb-notifications-preview-card {
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-card);
  background: var(--rb-surface);
  box-shadow: var(--rb-shadow-card);
}
.rb-notifications-preview-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--rb-radius-input);
  background: #f1f5f9;
}
.rb-notifications-preview-tabs button {
  flex: 1;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: #64748b;
  font-family: inherit;
}
.rb-notifications-preview-tabs button.is-active {
  background: var(--rb-teal);
  color: white;
  box-shadow: var(--rb-shadow-card);
}
.rb-notifications-kind-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.rb-notifications-kind-tabs button {
  border: none;
  border-radius: var(--rb-radius-pill);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: #64748b;
  font-family: inherit;
}
.rb-notifications-kind-tabs button.is-active {
  background: var(--rb-teal-light);
  color: #115e59;
  box-shadow: inset 0 0 0 1px #99f6e4;
}
.rb-notif-token-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.rb-notif-token-btn {
  border: 1px solid #ccfbf1;
  background: var(--rb-teal-light);
  color: #115e59;
  border-radius: var(--rb-radius-pill);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.rb-notif-token-btn:hover {
  background: #99f6e4;
}
.rb-notif-field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rb-text-secondary);
  margin: 0 0 8px;
}
.rb-notif-field-hint {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--rb-text-secondary);
}
.rb-notif-template-block {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.rb-notif-email-block {
  padding-top: 20px;
  border-top: 1px solid var(--rb-divider);
}
.rb-preview-sms-wrap {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.rb-preview-email-body {
  white-space: pre-wrap;
  color: var(--rb-text-primary);
  font-size: 14px;
  line-height: 1.5;
}
.rb-notifications-form-actions {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--rb-divider);
}
@media (max-width: 639px) {
  .rb-notifications-form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
}
.rb-notif-table-wrap {
  padding: 20px;
  overflow-x: auto;
}
.rb-preview-sms-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 28px 16px;
  min-height: 140px;
  max-width: 100%;
  overflow-x: hidden;
  background: transparent;
  border: none;
  box-shadow: none;
}
.rb-preview-sms-bubble {
  max-width: min(22rem, calc(100% - 24px));
  margin-left: auto;
  margin-right: auto;
  border-radius: 18px 18px 6px 18px;
  background: var(--rb-teal);
  color: white;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}
.rb-preview-sms-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.rb-notify-preview-root {
  border: none;
  box-shadow: none;
  background: transparent;
  overflow: visible;
  max-width: 100%;
}
.rb-notify-preview-root .rb-preview-email-wrap {
  margin-top: 8px;
}
.rb-preview-email-box {
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-card);
  background: #f8fafc;
  padding: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--rb-text-primary);
}

.rb-modal-backdrop[hidden] { display: none !important; }
.rb-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.rb-table-scroll > table {
  width: max(100%, max-content);
}
.rb-modal-stack { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; max-height: min(calc(100vh - 32px), 900px); }
.rb-modal-stack > .rb-modal-body-scroll { flex: 1 1 auto; min-height: 0; }
.rb-modal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.rb-stepper-text { min-width: 5.5rem; text-align: center; font-size: 14px; font-weight: 600; color: #334155; }
.rb-segmented { display: flex; flex: 1; gap: 4px; border-radius: 12px; background: #f1f5f9; padding: 5px; font-size: 14px; font-weight: 600; min-width: 12rem; max-width: 40rem; }
.rb-segment { flex: 1; border: none; border-radius: 8px; padding: 12px 16px; background: transparent; color: #64748b; cursor: pointer; font: inherit; line-height: 1.25; text-align: center; transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease; }
a.rb-segment { text-decoration: none; text-align: center; box-sizing: border-box; color: inherit; display: inline-flex; align-items: center; justify-content: center; }
.rb-segment:hover { color: #334155; }
.rb-segment.is-active { background: var(--rb-teal); color: white; box-shadow: var(--rb-shadow-card); }
.rb-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--rb-radius-input); border: 1px solid var(--rb-border); background: white; color: #334155; box-shadow: var(--rb-shadow-card); cursor: pointer; }
.rb-icon-btn:hover:not(:disabled) { background: #f8fafc; }
.rb-icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rb-um-edit-col { width: 52px; text-align: right; white-space: nowrap; }
.rb-um-invite-panel { margin-bottom: 16px; padding: 16px; border-radius: var(--rb-radius-card); border: 1px solid var(--rb-border); background: #f0fdfa; }
.rb-um-invite-panel-title { margin: 0 0 4px; font-weight: 600; font-size: 15px; color: #0f766e; }
.rb-um-invite-copy-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rb-um-invite-copy-row .rb-input { flex: 1; min-width: 12rem; }
.rb-um-inactive-toggle { font-size: 14px; padding: 0; border: none; background: none; cursor: pointer; }
.rb-um-inactive-toggle:hover { text-decoration: underline; }
.rb-payment-layout { display: flex; flex-direction: column; gap: 24px; }
@media (min-width: 1024px) {
  .rb-payment-layout { flex-direction: row; align-items: flex-start; }
  .rb-payment-sidebar { width: 320px; flex-shrink: 0; }
  .rb-payment-main { min-width: 0; flex: 1; }
}
.rb-tenant-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rb-tenant-list a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; border-radius: var(--rb-radius-input); border: 1px solid transparent; padding: 10px 12px; font-size: 14px; color: var(--rb-text-primary); text-decoration: none; transition: background-color 150ms ease, border-color 150ms ease; }
.rb-tenant-list a:hover { background: #f8fafc; }
.rb-tenant-list a.is-active { border-color: #5eead4; background: #f0fdfa; font-weight: 600; color: #115e59; }
.rb-tenant-list-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.rb-tenant-list-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rb-tenant-list-balance {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 13px;
}
.rb-ctx-panel { border: 1px solid var(--rb-border); border-radius: var(--rb-radius-card); background: #f8fafc; padding: 12px 16px; font-size: 14px; color: var(--rb-text-primary); }
.rb-payment-summary-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .rb-payment-summary-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .rb-payment-summary-grid { grid-template-columns: repeat(3, 1fr); } }
.rb-payment-summary-cell { border: 1px solid var(--rb-border); border-radius: var(--rb-radius-card); background: #f8fafc; padding: 16px; }
.rb-payment-summary-credit { background: rgba(236, 253, 245, 0.55); border-color: #bbf7d0; }
.rb-payment-summary-hero { background: rgba(204, 251, 241, 0.35); border-color: #99f6e4; }
.rb-payment-summary-span { grid-column: 1 / -1; }
.rb-ledger-credit { color: #047857; }
.rb-hidden { display: none !important; }
.rb-settings-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .rb-settings-grid { grid-template-columns: repeat(2, 1fr); } }
.rb-settings-tile {
  display: flex;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-card);
  background: white;
  padding: 20px;
  min-height: 92px;
  box-shadow: var(--rb-shadow-card);
  text-decoration: none;
  color: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.rb-settings-tile:hover { border-color: #5eead4; box-shadow: 0 4px 14px rgba(15, 118, 110, 0.08); }
.rb-settings-tile-icon { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--rb-teal-light); color: #0f766e; border: 1px solid #ccfbf1; }
.rb-settings-tile-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.rb-settings-tile-title { font-weight: 600; color: var(--rb-text-primary); font-size: 16px; }
.rb-settings-tile:hover .rb-settings-tile-title { color: #115e59; }
.rb-settings-tile-desc {
  margin-top: 2px;
  font-size: 14px;
  color: var(--rb-text-secondary);
  line-height: 1.45;
}
.rb-settings-tile-arrow { align-self: center; color: #94a3b8; font-size: 20px; line-height: 1; }
.rb-settings-tile:hover .rb-settings-tile-arrow { color: var(--rb-teal); }
.rb-section-warn { border-color: #fcd34d; background: rgba(254, 243, 199, 0.25); }
.rb-section-warn .rb-section-card-header { border-bottom-color: #fcd34d; background: rgba(254, 243, 199, 0.35); }
details.rb-section-card > summary { cursor: pointer; list-style: none; }
details.rb-section-card > summary::-webkit-details-marker { display: none; }
.rb-input-wrap { position: relative; }
.rb-input-wrap .rb-input { padding-right: 40px; }
.rb-input-suffix-btn { position: absolute; top: 0; right: 0; bottom: 0; width: 40px; border: none; background: transparent; color: #64748b; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 0 var(--rb-radius-input) var(--rb-radius-input) 0; }
.rb-input-suffix-btn:hover { color: #334155; }
.rb-checkbox-row { display: flex; cursor: pointer; align-items: center; gap: 12px; border-radius: var(--rb-radius-input); border: 1px solid var(--rb-divider); background: #f8fafc; padding: 10px 12px; font-size: 14px; color: var(--rb-text-primary); }

/* Pills / Badges / Chips */
.rb-pill { display: inline-flex; align-items: center; gap: 4px; border-radius: var(--rb-radius-pill); padding: 4px 10px; font-size: 12px; line-height: 16px; font-weight: 700; white-space: nowrap; }
.rb-pill-success { background: var(--rb-success-bg); color: #047857; }
.rb-pill-warning { background: var(--rb-warning-bg); color: #b45309; }
.rb-pill-danger { background: var(--rb-danger-bg); color: #dc2626; }
.rb-pill-info { background: var(--rb-info-bg); color: #2563eb; }
.rb-pill-neutral { background: #f1f5f9; color: #64748b; }
.rb-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--rb-radius-pill); padding: 6px 12px; font-size: 13px; line-height: 18px; font-weight: 700; white-space: nowrap; }
.rb-chip-warning { border: 1px solid #fed7aa; background: var(--rb-warning-bg); color: #9a3412; }
.rb-chip-success { border: 1px solid #bbf7d0; background: var(--rb-success-bg); color: #047857; }

/* Alerts */
.rb-alert { border-radius: var(--rb-radius-card); padding: 16px; }
.rb-alert-success { border: 1px solid #bbf7d0; background: var(--rb-success-bg); color: #047857; }
.rb-alert-warning { border: 1px solid #fed7aa; background: var(--rb-warning-bg); color: #9a3412; }
.rb-alert-danger { border: 1px solid #fecaca; background: var(--rb-danger-bg); color: #b91c1c; }
.rb-alert-info { border: 1px solid #bfdbfe; background: var(--rb-info-bg); color: #1d4ed8; }
.rb-success-banner { border: 1px solid #bbf7d0; border-radius: var(--rb-radius-card); background: var(--rb-success-bg); padding: 20px; }
.rb-success-banner-icon { display: flex; height: 40px; width: 40px; flex-shrink: 0; align-items: center; justify-content: center; border-radius: 8px; background: #dcfce7; color: #047857; }
.rb-success-banner-title { color: #047857; font-size: 16px; line-height: 24px; font-weight: 600; }
.rb-success-banner-text { margin-top: 4px; color: rgba(4, 120, 87, 0.9); font-size: 14px; line-height: 20px; }
.rb-warning-banner { border: 1px solid #fed7aa; border-radius: var(--rb-radius-card); background: var(--rb-warning-bg); padding: 12px 16px; color: #9a3412; font-size: 14px; line-height: 20px; font-weight: 600; }

/* Forms */
.rb-input, .rb-select, .rb-textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid #94a3b8;
  border-radius: var(--rb-radius-input);
  background: white;
  color: var(--rb-text-primary);
  font-size: 14px;
  line-height: 20px;
  box-shadow: none;
}
.rb-input, .rb-select {
  min-height: 40px;
  height: 40px;
  padding: 0 12px;
}
input[type="date"].rb-input,
input[type="datetime-local"].rb-input,
input[type="email"].rb-input,
input[type="password"].rb-input,
input[type="number"].rb-input,
input[type="text"].rb-input {
  min-height: 40px;
  height: 40px;
}
.rb-textarea { min-height: 96px; padding: 12px; resize: vertical; height: auto; }
.rb-input::placeholder, .rb-textarea::placeholder { color: var(--rb-text-muted); }
.rb-input:hover, .rb-select:hover, .rb-textarea:hover { border-color: #64748b; }
.rb-input:focus, .rb-select:focus, .rb-textarea:focus {
  border-color: var(--rb-teal);
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 157, 141, 0.2);
}
.rb-input:disabled, .rb-select:disabled, .rb-textarea:disabled,
.rb-input[readonly], .rb-textarea[readonly] {
  background: #f1f5f9;
  color: #64748b;
  border-color: #cbd5e1;
  cursor: not-allowed;
}
.rb-input-error { border-color: var(--rb-danger); }
.rb-input-error:focus { border-color: var(--rb-danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18); }
.rb-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%2364748b' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: 36px;
}
/* Setup / invite forms: ensure visible outlines even if a widget omits rb-* */
.rb-setup-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.rb-setup-form select,
.rb-setup-form textarea,
.rb-form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.rb-form-field select,
.rb-form-field textarea {
  border: 1px solid #94a3b8;
  border-radius: var(--rb-radius-input);
  min-height: 40px;
  padding: 0 12px;
  background: #fff;
  box-sizing: border-box;
}
.rb-setup-form textarea,
.rb-form-field textarea {
  min-height: 96px;
  padding: 12px;
  height: auto;
}
.rb-setup-form input:focus,
.rb-setup-form select:focus,
.rb-setup-form textarea:focus,
.rb-form-field input:focus,
.rb-form-field select:focus,
.rb-form-field textarea:focus {
  border-color: var(--rb-teal);
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 157, 141, 0.2);
}
.rb-help-text { margin-top: 4px; color: var(--rb-text-secondary); font-size: 12px; line-height: 16px; }
.rb-error-text { margin-top: 4px; color: var(--rb-danger); font-size: 12px; line-height: 16px; font-weight: 500; }

/* Modals — shared sizing (md default) */
.rb-modal-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.45); padding: 24px; }
.rb-modal {
  width: 100%;
  max-width: min(720px, calc(100vw - 48px));
  min-width: 0;
  box-sizing: border-box;
  border-radius: var(--rb-radius-modal);
  background: white;
  box-shadow: var(--rb-shadow-modal);
  display: flex;
  flex-direction: column;
  max-height: min(calc(100vh - 32px), 900px);
  overflow-x: hidden;
}
.rb-modal * {
  box-sizing: border-box;
}
.rb-modal-doc {
  overflow-x: hidden;
  min-width: 0;
}
.rb-modal .rb-input,
.rb-modal .rb-select,
.rb-modal .rb-textarea {
  max-width: 100%;
  min-width: 0;
}
.rb-modal .rb-settings-grid,
.rb-modal .rb-form-grid,
.rb-modal .rb-form-row {
  min-width: 0;
  max-width: 100%;
}
.rb-modal-sm { max-width: min(520px, calc(100vw - 48px)); }
.rb-modal-md { max-width: min(720px, calc(100vw - 48px)); }
.rb-modal-lg { max-width: min(920px, calc(100vw - 48px)); }
.rb-modal-header { flex-shrink: 0; padding: 24px; padding-right: 48px; }
.rb-modal-title { color: var(--rb-text-primary); font-size: 18px; line-height: 28px; font-weight: 600; }
.rb-modal-subtitle { margin-top: 4px; color: var(--rb-text-secondary); font-size: 14px; line-height: 20px; }
.rb-modal-body {
  padding: 0 24px 24px;
  max-height: calc(100vh - 160px);
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
}
.rb-modal-body-scroll {
  max-height: calc(100vh - 160px);
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
}
.rb-modal-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--rb-divider);
  padding: 16px 24px;
}
.rb-modal-warning-box { border: 1px solid #fed7aa; border-radius: var(--rb-radius-card); background: var(--rb-warning-bg); padding: 16px; color: #9a3412; font-size: 14px; line-height: 20px; }
.rb-form-grid { display: flex; flex-direction: column; gap: 20px; }
.rb-form-row { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .rb-form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rb-form-row--address {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 0.85fr);
  }
}
.rb-form-field { min-width: 0; }
.rb-form-field .rb-label { display: block; margin-bottom: 6px; }

/* Plain checkbox row (Lease Contacts style) — not the bordered .rb-checkbox-row card. */
.rb-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--rb-text-primary);
}
.rb-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--rb-teal);
}
.rb-mailing-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 12px;
}
.rb-input-affix {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}
.rb-input-affix-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #94a3b8;
  border-right: none;
  border-radius: var(--rb-radius-input) 0 0 var(--rb-radius-input);
  background: #f8fafc;
  color: var(--rb-text-secondary);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  flex-shrink: 0;
}
.rb-input-affix .rb-input {
  border-radius: 0 var(--rb-radius-input) var(--rb-radius-input) 0;
  min-width: 0;
}
.rb-input-affix:focus-within .rb-input-affix-prefix {
  border-color: var(--rb-teal);
}
.rb-callout {
  margin: 0 0 12px;
  border-radius: var(--rb-radius-input);
  padding: 10px 12px;
  font-size: 14px;
  line-height: 20px;
}
.rb-callout--warning {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
}
.rb-inline-link {
  font-weight: 600;
  color: var(--rb-teal);
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}
.rb-inline-link:hover { color: #0f766e; }

/* Tables / Ledgers */
.rb-table-sort-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.rb-table-sort-link:hover {
  color: var(--rb-teal, #0f766e);
}
.rb-table-sort-link.is-active {
  color: var(--rb-text-primary, #0f172a);
}
.rb-table-sort-arrow {
  font-size: 10px;
  line-height: 1;
  opacity: 0.85;
}
.rb-table-sort-arrow-muted {
  opacity: 0.35;
  font-size: 9px;
}
.rb-table-shell { overflow: hidden; border: 1px solid var(--rb-border); border-radius: var(--rb-radius-card); background: white; box-shadow: var(--rb-shadow-card); }
.rb-table { width: 100%; border-collapse: collapse; }
.rb-table thead { background: #f8fafc; }
.rb-table th { padding: 12px 16px; color: #64748b; text-align: left; font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.rb-table td { border-top: 1px solid var(--rb-divider); padding: 12px 16px; color: var(--rb-text-primary); font-size: 14px; line-height: 20px; }
.rb-table tbody tr:hover { background: #f8fafc; }
.rb-table-number {
  font-family: var(--rb-font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* Enter readings — task table (centered numerics, wide record column) */
.rb-enter-readings-table .rb-enter-th-center,
.rb-enter-readings-table .rb-enter-td-center {
  text-align: center;
}
.rb-enter-readings-table .rb-enter-col-record {
  width: 26%;
  min-width: 15rem;
}
.rb-enter-readings-table .rb-enter-col-num {
  width: 10%;
  min-width: 6rem;
}
.rb-enter-readings-table .rb-enter-col-warn {
  width: 3.5rem;
}
.rb-reading-current-cell { vertical-align: top; }
.rb-reading-input-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 18rem;
  width: 100%;
  margin: 0 auto;
}
.rb-reading-recorded-meta {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--rb-text-muted);
  text-align: center;
  max-width: 18rem;
}
.rb-reading-input {
  width: 100%;
  max-width: 16rem;
  text-align: center;
}
.rb-reading-anomaly-hint {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 24px;
  padding: 14px 18px;
  border-radius: var(--rb-radius-modal);
  border: 1px solid #f59e0b;
  background: var(--rb-warning-bg);
  color: #9a3412;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: var(--rb-shadow-card);
}
.rb-reading-anomaly-hint svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: #d97706;
}
tr.reading-row.anomaly-row { background: #fffbeb !important; }
tr.rb-reading-row-vacant { background: #FEF3C7; }
.usage-cell {
  font-family: var(--rb-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.usage-cell.is-empty { color: #94a3b8; }
.usage-cell.is-flagged { color: #92400e; font-weight: 600; }
.usage-cell.is-normal { color: var(--rb-text-primary); }
.rb-enter-warn-cell {
  text-align: center;
  vertical-align: middle;
}
.warn-icon { display: none; align-items: center; justify-content: center; margin: 0 auto; }
.warn-icon.is-visible { display: inline-flex; }
.live-calc-water,
.live-calc-sewer,
.live-calc-total {
  font-family: var(--rb-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--rb-text-secondary);
  white-space: nowrap;
}
.live-calc-total { color: var(--rb-text-primary); font-weight: 600; }

/* Review readings — locked banner, warning icon, add reading */
.rb-readings-locked-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 0;
  margin-bottom: 20px;
  padding: 16px 18px;
  border-radius: var(--rb-radius-card);
  border: 1px solid #f59e0b;
  background: var(--rb-warning-bg);
  color: #9a3412;
}
.rb-readings-workflow-alert {
  margin-top: 0;
  margin-bottom: 20px;
}
.rb-readings-workflow-panel {
  margin-top: 0;
}
.rb-readings-open-helper {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.45;
}
.rb-readings-locked-banner svg {
  flex-shrink: 0;
  color: #d97706;
  margin-top: 2px;
}
.rb-readings-locked-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #92400e;
}
.rb-readings-locked-text {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: #9a3412;
}
.rb-review-readings-table thead th {
  vertical-align: middle;
}
.rb-review-readings-table tbody td {
  vertical-align: middle;
}
.rb-review-readings-table .rb-review-th-center,
.rb-review-readings-table .rb-review-td-center {
  text-align: center;
}
.rb-review-readings-table .rb-review-col-lot {
  width: 18%;
  max-width: 15rem;
}
.rb-review-readings-table .rb-review-col-prev {
  width: 6.5rem;
}
.rb-review-readings-table .rb-review-col-current {
  width: auto;
  min-width: 17rem;
}
.rb-review-readings-table .rb-review-col-usage {
  width: 6rem;
}
.rb-review-readings-table .rb-review-col-warn {
  width: 3.5rem;
}
.rb-review-th-current {
  text-align: left;
}
.rb-review-lot-cell {
  vertical-align: middle;
}
.rb-review-lot-meter {
  font-size: 14px;
  line-height: 1.35;
}
.rb-review-lot-tenant {
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.35;
}
.rb-review-num-cell {
  font-size: 14px;
}
.rb-review-usage-cell {
  vertical-align: middle;
  padding-top: 0;
  font-size: 14px;
}
.rb-review-warn-host {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.rb-review-warn-host.rb-hidden {
  display: none !important;
}
.rb-review-tooltip {
  position: absolute;
  bottom: 100%;
  right: 0;
  left: auto;
  transform: none;
  margin-bottom: 8px;
  min-width: 12rem;
  max-width: min(18rem, calc(100vw - 32px));
  padding: 10px 12px;
  border-radius: var(--rb-radius-input);
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #92400e;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 30;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease, visibility 120ms ease;
  pointer-events: none;
}
.rb-review-tooltip--flip {
  right: auto;
  left: 0;
}
.rb-review-tooltip-line {
  margin: 0 0 6px;
}
.rb-review-tooltip-line:last-child {
  margin-bottom: 0;
}
.rb-review-tooltip-k {
  color: #9a3412;
  font-weight: 600;
  margin-right: 4px;
}
.rb-review-tooltip-v {
  font-weight: 600;
}
.rb-review-tooltip-compare {
  font-weight: 600;
  color: #b45309;
}
.rb-review-warn-host:hover .rb-review-tooltip,
.rb-review-warn-host:focus-within .rb-review-tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.rb-review-selected-cell {
  vertical-align: middle;
}
.rb-review-warn-cell {
  text-align: center;
  vertical-align: middle;
}
.rb-review-warn-dash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  color: var(--rb-text-muted);
  font-size: 15px;
}
.rb-review-warn-dash--muted {
  color: var(--rb-divider);
}
.rb-review-warn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #fcd34d;
  border-radius: var(--rb-radius-input);
  background: #fffbeb;
  color: #d97706;
  cursor: help;
  font: inherit;
  box-shadow: var(--rb-shadow-card);
}
.rb-review-warn-btn:hover,
.rb-review-warn-btn:focus-visible {
  background: #fef3c7;
  outline: 2px solid rgba(245, 158, 11, 0.45);
  outline-offset: 2px;
}
.rb-review-add-reading {
  margin-top: 10px;
}
.rb-review-add-reading > summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
}
.rb-review-add-reading > summary::-webkit-details-marker {
  display: none;
}
.rb-review-add-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-input);
  background: #f8fafc;
}
.rb-review-add-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.rb-review-add-input {
  flex: 1 1 10rem;
  min-width: 8rem;
  max-width: 14rem;
}

/* Row Lists / Workflow Rows */
.rb-row-card { border: 1px solid var(--rb-border); border-radius: var(--rb-radius-card); background: white; box-shadow: var(--rb-shadow-card); transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease; }
.rb-row-card:hover { border-color: #cbd5e1; }
.rb-row-card-button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; text-align: left; }
.rb-lot-badge {
  display: inline-flex;
  height: 32px;
  min-width: 32px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: var(--rb-radius-pill);
  background: #f1f5f9;
  padding: 0 10px;
  color: #334155;
  font-family: var(--rb-font-sans);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rb-expanded-panel { border-top: 1px solid var(--rb-divider); background: rgba(248, 250, 252, 0.65); padding: 20px; }

/* Dashboard Workflow */
.rb-workflow-card { overflow: hidden; border: 1px solid var(--rb-border); border-radius: var(--rb-radius-card); background: white; box-shadow: var(--rb-shadow-card); }
.rb-workflow-step { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 16px; border-top: 1px solid var(--rb-divider); padding: 20px; }
.rb-workflow-step:first-child { border-top: 0; }
.rb-workflow-icon { display: flex; height: 40px; width: 40px; align-items: center; justify-content: center; border-radius: var(--rb-radius-pill); font-weight: 700; }
.rb-workflow-complete { color: #047857; }
.rb-workflow-complete .rb-workflow-icon { background: #dcfce7; color: #047857; }
.rb-workflow-current { color: var(--rb-text-primary); }
.rb-workflow-current .rb-workflow-icon { background: var(--rb-teal); color: white; }
.rb-workflow-pending { color: var(--rb-text-secondary); }
.rb-workflow-pending .rb-workflow-icon { background: #f1f5f9; color: #64748b; }

/* Notification Preview (see also .rb-preview-sms-* / .rb-preview-email-* near .rb-notifications-layout) */
.rb-preview-email-wrap { margin-top: 16px; }
.rb-preview-card { overflow: hidden; border: 1px solid var(--rb-border); border-radius: var(--rb-radius-card); background: white; box-shadow: var(--rb-shadow-card); }
.rb-preview-body { padding: 20px; }
.rb-segmented-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; border-radius: 12px; background: #f1f5f9; padding: 6px; }
.rb-segmented-control button, .rb-segmented-control a { border-radius: 8px; padding: 10px 12px; text-align: center; font-weight: 700; color: #64748b; text-decoration: none; }
.rb-segmented-control .is-active { background: var(--rb-teal); color: white; box-shadow: var(--rb-shadow-card); }
.rb-message-bubble { border: 1px solid #99f6e4; border-radius: 20px; background: #ecfdf5; padding: 16px; color: var(--rb-text-primary); font-size: 16px; line-height: 28px; }
.rb-email-preview { border: 1px solid var(--rb-border); border-radius: var(--rb-radius-card); background: white; padding: 20px; color: var(--rb-text-primary); box-shadow: var(--rb-shadow-card); }

/* Utility Helpers */
.rb-divider { border-top: 1px solid var(--rb-divider); }
.rb-muted { color: var(--rb-text-secondary); }
.rb-link { color: #0f766e; font-weight: 600; text-decoration: none; }
.rb-link:hover { color: #115e59; text-decoration: underline; }
.rb-icon-tile { display: inline-flex; height: 48px; width: 48px; align-items: center; justify-content: center; border-radius: 12px; }
.rb-icon-tile-warning { background: #fef3c7; color: #b45309; }
.rb-icon-tile-danger { background: #fee2e2; color: #dc2626; }
.rb-icon-tile-success { background: #dcfce7; color: #047857; }
.rb-icon-tile-info { background: #dbeafe; color: #2563eb; }
.rb-clickable-card { cursor: pointer; transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease; }
.rb-clickable-card:hover { border-color: #99f6e4; box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06); transform: translateY(-1px); }

@media (max-width: 1023px) {
  .rb-page-shell {
    --rb-page-pad-x: 20px;
    --rb-page-pad-y: 20px;
  }
  .rb-main-with-sidebar { margin-left: 0; }
  .rb-sidebar--desktop { display: none !important; }
  .rb-workflow-step { grid-template-columns: 40px 1fr; }
  .rb-workflow-step > :last-child { grid-column: 2; justify-self: start; }
}
@media (max-width: 640px) {
  .rb-page-shell {
    --rb-page-pad-x: 16px;
    --rb-page-pad-y: 16px;
  }
}

/* ----- App shell (sidebar + main) — replaces inline base.html styles ----- */
.rb-app-body { margin: 0; min-height: 100vh; }
.rb-sidebar-inner {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 24px 16px;
  box-sizing: border-box;
}
.rb-sidebar-brand {
  padding: 4px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}
.rb-sidebar-brand-name {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: #f4f4f5;
}
.rb-sidebar-brand-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: #a1a1aa;
}
.rb-sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.rb-nav-group {
  margin: 14px 0;
}
.rb-nav-group-title {
  margin-bottom: 6px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a1a1aa;
}
.rb-sidebar a {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 0;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #e5e7eb;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  box-sizing: border-box;
}
.rb-sidebar a:hover {
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.06);
}
.rb-sidebar a.active {
  border-color: rgba(14, 165, 164, 0.35);
  background: rgba(14, 165, 164, 0.18);
  color: #eaffff;
  font-weight: 550;
}
.rb-nav-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.7;
  color: #a1a1aa;
}
.rb-sidebar a:hover .rb-nav-icon {
  opacity: 0.95;
  color: #e4e4e7;
}
.rb-sidebar a.active .rb-nav-icon {
  opacity: 1;
  color: #fff;
}
.rb-sidebar-footer {
  margin-top: auto;
  flex-shrink: 0;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.rb-sidebar-footer form { margin: 0; }
.rb-sidebar-footer button[type="submit"] {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #a1a1aa;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}
.rb-sidebar-footer button[type="submit"]:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
}
.rb-main { min-width: 0; }

/* ----- Tablet/mobile app topbar + nav drawer (shared with desktop nav body) ----- */
.rb-app-topbar {
  display: none;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rb-border);
  background: var(--rb-surface);
  position: sticky;
  top: 0;
  z-index: var(--rb-nav-z-topbar);
  box-sizing: border-box;
}
.rb-app-topbar-brand {
  min-width: 0;
  flex: 1;
}
.rb-app-topbar-title {
  display: block;
  font-size: 15px;
  font-weight: 650;
  color: var(--rb-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rb-nav-hamburger,
.rb-nav-drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-input);
  background: var(--rb-surface);
  color: var(--rb-text-primary);
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
}
.rb-nav-hamburger:hover,
.rb-nav-drawer-close:hover {
  background: #f8fafc;
}
.rb-nav-hamburger:focus-visible,
.rb-nav-drawer-close:focus-visible,
.rb-setup-checklist-open:focus-visible {
  outline: 2px solid rgba(31, 157, 141, 0.45);
  outline-offset: 2px;
}
.rb-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--rb-nav-z-backdrop);
  background: rgba(15, 23, 42, 0.45);
  border: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}
.rb-nav-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.rb-nav-backdrop[hidden] { display: none !important; }
.rb-sidebar--drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: var(--rb-drawer-width);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: var(--rb-nav-z-drawer);
  transform: translateX(-105%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 180ms ease, visibility 180ms ease;
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.rb-sidebar--drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}
.rb-sidebar--drawer[hidden] {
  display: none !important;
}
.rb-sidebar--drawer .rb-sidebar-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.rb-sidebar--drawer .rb-sidebar-footer {
  flex-shrink: 0;
}
.rb-drawer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 0;
  flex-shrink: 0;
}
.rb-drawer-toolbar-label {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a1a1aa;
  padding-left: 8px;
}
.rb-sidebar--drawer .rb-nav-drawer-close {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f4f4f5;
}
.rb-sidebar--drawer .rb-nav-drawer-close:hover {
  background: rgba(255, 255, 255, 0.12);
}
body.rb-nav-scroll-lock,
body.rb-setup-checklist-scroll-lock {
  overflow: hidden;
}
@media (min-width: 1024px) {
  .rb-app-topbar { display: none !important; }
  .rb-nav-backdrop,
  .rb-sidebar--drawer { display: none !important; }
  .rb-nav-hamburger { display: none !important; }
}
@media (max-width: 1023px) {
  .rb-app-topbar { display: flex; }
  .rb-sidebar--desktop { display: none !important; }
  .rb-main-with-sidebar { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .rb-sidebar--drawer,
  .rb-nav-backdrop,
  .rb-setup-checklist-drawer,
  .rb-setup-checklist-backdrop {
    transition: none;
  }
}

/* Page structure */
.rb-page-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.rb-page-header-text {
  min-width: 0;
  flex: 1 1 12rem;
}
.rb-page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
}
.rb-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}
/* Compact billing period bar: Property / Year / Month / Apply */
.rb-toolbar-row.rb-period-toolbar {
  gap: 8px 12px;
  margin-top: 4px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-card);
  background: var(--rb-surface);
  box-shadow: var(--rb-shadow-card);
  align-items: flex-end;
}
.rb-toolbar-row.rb-period-toolbar .rb-label {
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}
.rb-toolbar-row.rb-period-toolbar .rb-field-stack {
  gap: 4px;
}
.rb-toolbar-row.rb-period-toolbar input[type="number"].rb-input,
.rb-toolbar-row.rb-period-toolbar .rb-input[type="number"] {
  max-width: 4.75rem;
  min-width: 4.25rem;
  padding-left: 8px;
  padding-right: 8px;
}
.rb-toolbar-row.rb-period-toolbar .rb-select {
  min-width: 8.75rem;
}
/* Uniform control height in billing period bars (year vs month vs Apply). */
.rb-toolbar-row.rb-period-toolbar .rb-input,
.rb-toolbar-row.rb-period-toolbar .rb-select,
.rb-toolbar-row.rb-period-toolbar .rb-btn {
  min-height: 40px;
  height: 40px;
  box-sizing: border-box;
}
.rb-toolbar-row.rb-period-toolbar .rb-btn {
  padding-top: 0;
  padding-bottom: 0;
  align-self: flex-end;
}
.rb-toolbar-row.rb-period-toolbar input[type="number"].rb-input,
.rb-toolbar-row.rb-period-toolbar .rb-input[type="number"] {
  max-width: 6rem;
}
.rb-toolbar-row.rb-period-toolbar .rb-period-property-select {
  min-width: 11rem;
}
.rb-field-stack {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.rb-grid-kpi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
@media (max-width: 900px) {
  .rb-grid-kpi { grid-template-columns: 1fr; }
}
.rb-grid-summary-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
  .rb-grid-summary-4 { grid-template-columns: 1fr; }
}
.rb-kpi-link {
  display: flex;
  gap: 1rem;
  padding: 20px;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-card);
  background: var(--rb-surface);
  box-shadow: var(--rb-shadow-card);
  color: inherit;
  text-decoration: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.rb-kpi-link:hover {
  border-color: #99f6e4;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}
.rb-kpi-link-body { min-width: 0; flex: 1; }
.rb-kpi-link-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.rb-chevron-muted {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: #cbd5e1;
}
.rb-kpi-link:hover .rb-chevron-muted { color: #94a3b8; }

/* Workflow row list (dashboard) */
.rb-workflow-muted { background: rgba(248, 250, 252, 0.85); }
.rb-workflow-future { opacity: 0.72; }
.rb-workflow-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 999px;
  background: #dcfce7;
  color: #047857;
}
.rb-workflow-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
}
.rb-workflow-num-current {
  background: #0f172a;
  color: #fff;
}
.rb-workflow-num-pending {
  background: #e2e8f0;
  color: #64748b;
}
.rb-workflow-row-flex {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--rb-divider);
}
.rb-workflow-row-flex:first-child { border-top: none; }
.rb-workflow-title { font-size: 14px; font-weight: 600; color: var(--rb-text-primary); }
.rb-workflow-title-muted { color: #64748b; }
.rb-workflow-sub { margin-top: 0.25rem; font-size: 12px; line-height: 1.4; }
.rb-workflow-sub-success { font-weight: 600; color: #047857; }
.rb-workflow-sub-muted { color: #64748b; }

/* Dashboard horizontal month billing progress */
.rb-month-progress-body { padding: 16px 20px 20px; box-sizing: border-box; max-width: 100%; }
.rb-month-progress-track {
  display: flex;
  width: 100%;
  align-items: flex-start;
  box-sizing: border-box;
}
.rb-month-progress-col {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
}
.rb-month-progress-rail { display: flex; align-items: center; width: 100%; margin-bottom: 8px; }
.rb-month-progress-seg { flex: 1 1 0; height: 3px; border-radius: 2px; min-width: 0; }
.rb-month-progress-seg-empty { visibility: hidden; }
.rb-month-progress-seg-done { background: #22c55e; }
.rb-month-progress-seg-pending { background: #e2e8f0; }
.rb-month-progress-dot {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: none;
}
.rb-month-progress-dot-done { background: #22c55e; color: #ffffff; }
.rb-month-progress-dot-current {
  background: var(--rb-teal);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.rb-month-progress-dot-future {
  background: #e2e8f0;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.rb-month-progress-label {
  margin: 0 auto;
  max-width: 100%;
  padding: 0 4px;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--rb-text-primary);
}
.rb-month-progress-label-current { color: #0f766e; font-weight: 700; }
.rb-month-progress-label-future { color: #94a3b8; font-weight: 500; }
.rb-month-progress-label-done { color: #166534; font-weight: 600; }
.rb-month-progress-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--rb-divider);
  min-width: 0;
}
.rb-month-progress-headline {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
  font-size: 17px;
  font-weight: 650;
  color: var(--rb-text-primary);
  line-height: 1.35;
}
.rb-month-progress-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
  min-width: 0;
}
.rb-mp-mono { font-family: var(--rb-font-mono); font-size: 12px; }
@media (max-width: 640px) {
  .rb-month-progress-label { font-size: 11px; }
  .rb-month-progress-dot { width: 26px; height: 26px; font-size: 12px; }
  .rb-month-progress-dot-done svg { width: 13px; height: 13px; }
}

/* Details / row disclosure */
details summary.rb-details-summary::-webkit-details-marker { display: none; }
details summary.rb-details-summary { list-style: none; }

/* ----- Legacy aliases (receipts & older fragments) ----- */
.billing-page-shell {
  max-width: var(--rb-content-max);
  margin-inline: auto;
  padding: 32px;
  box-sizing: border-box;
}
@media (max-width: 900px) {
  .billing-page-shell { padding: 24px 16px; }
}
.card {
  overflow: hidden;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-card);
  background: white;
  box-shadow: var(--rb-shadow-card);
  padding: 1rem 1.15rem;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th,
table.data td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--rb-divider);
  text-align: left;
}
table.data th {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
table.data tbody tr:hover { background: #f8fafc; }
table.data a.row-link {
  color: var(--rb-teal);
  font-weight: 500;
  text-decoration: none;
}
table.data a.row-link:hover { text-decoration: underline; color: var(--rb-teal-hover); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.pill-void { background: #f1f5f9; color: #64748b; }
.pill-paid { background: var(--rb-success-bg); color: #047857; }
.pill-partial { background: var(--rb-warning-bg); color: #9a3412; }
.pill-posted { background: var(--rb-info-bg); color: #1d4ed8; }
.btn {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  border-radius: var(--rb-radius-input);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  border-color: var(--rb-teal);
  background: var(--rb-teal);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  border-color: var(--rb-teal-hover);
  background: var(--rb-teal-hover);
}
.btn-secondary {
  border-color: #e2e8f0;
  background: #f1f5f9;
  color: var(--rb-text-primary);
}
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }
.font-num { font-variant-numeric: tabular-nums; }

/* Post invoice tenant row */
.rb-post-tenant-details {
  display: grid;
  gap: 1rem;
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--rb-divider);
  background: rgba(248, 250, 252, 0.65);
}
@media (min-width: 860px) {
  .rb-post-tenant-details { grid-template-columns: 1fr 1fr; }
}
.rb-post-line-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rb-divider);
  font-size: 14px;
}
.rb-post-line-row:last-child { border-bottom: none; }
.rb-post-subcard {
  padding: 1rem;
  border: 1px solid var(--rb-divider);
  border-radius: var(--rb-radius-card);
  background: white;
  box-shadow: var(--rb-shadow-card);
}
.rb-post-subcard-title {
  margin-bottom: 0.75rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}
.rb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.rb-text-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--rb-teal);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.rb-text-link:hover { text-decoration: underline; color: var(--rb-teal-hover); }
.rb-inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; font-size: 14px; }
.rb-modal-dismiss,
.rb-modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 1.125rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  border-radius: var(--rb-radius-input);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rb-modal-dismiss:hover,
.rb-modal-close:hover { color: #475569; background: #f1f5f9; }
.rb-modal-relative { position: relative; }

/* Expandable tenant row (Post Invoices) */
.rb-details-tenant {
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-card);
  background: white;
  box-shadow: var(--rb-shadow-card);
}
.rb-details-tenant > summary {
  display: flex;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 14px 20px;
  list-style: none;
}
.rb-details-tenant > summary::-webkit-details-marker { display: none; }
.rb-meter-snap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  font-size: 12px;
}
@media (min-width: 640px) {
  .rb-meter-snap-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.rb-meter-snap-box {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: var(--rb-radius-input);
  border: 1px solid var(--rb-divider);
  background: white;
}
.rb-meter-snap-box.is-anomaly {
  border-color: #fed7aa;
  background: var(--rb-warning-bg);
}
.rb-col-span-full { grid-column: 1 / -1; }

/* --------------------------------------------------------------------------
   Wide settle modal + document preview modal + printable documents
   -------------------------------------------------------------------------- */
.rb-modal-settle {
  width: 100%;
  max-width: min(920px, calc(100vw - 48px));
  overflow-x: hidden;
  min-width: 0;
}
.rb-modal-settle .rb-modal-body {
  overflow-x: hidden;
  min-width: 0;
}
.rb-emergency-meter-btn {
  white-space: normal;
  min-height: 40px;
  padding-left: 14px;
  padding-right: 14px;
}
.rb-settle-balance-banner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid #fed7aa;
  border-radius: var(--rb-radius-card);
  background: var(--rb-warning-bg);
  color: #9a3412;
  font-size: 14px;
  line-height: 1.4;
}
@media (max-width: 520px) {
  .rb-settle-balance-banner { grid-template-columns: 1fr; }
}
.rb-settle-balance-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b45309;
}
.rb-settle-balance-value {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 600;
}
.rb-settle-forms-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .rb-settle-forms-grid { grid-template-columns: 1fr 1fr; }
}

.rb-modal-doc {
  width: 100%;
  max-width: min(920px, calc(100vw - 48px));
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
}
.rb-doc-preview-backdrop {
  z-index: 60;
}
.rb-doc-preview-toolbar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--rb-divider);
}
.rb-doc-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.rb-doc-preview-body {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px;
  background: var(--rb-bg);
  min-width: 0;
}

/* Formal receipt / invoice sheet (screen + print) */
.rb-print-sheet {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 32px;
  border-radius: var(--rb-radius-card);
  background: var(--rb-surface);
  border: 1px solid var(--rb-border);
  color: var(--rb-text-primary);
  box-shadow: var(--rb-shadow-card);
}
.rb-receipt-print-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--rb-teal);
}
.rb-receipt-print-header-left { min-width: 0; }
.rb-receipt-print-header-right { flex-shrink: 0; }
.rb-receipt-print-brand { font-size: 18px; font-weight: 700; color: var(--rb-text-primary); }
.rb-receipt-print-muted { font-size: 13px; color: var(--rb-text-secondary); line-height: 1.45; }
.rb-receipt-print-logo { max-height: 64px; max-width: 180px; object-fit: contain; }
.rb-receipt-print-title {
  margin: 20px 0 16px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--rb-teal);
}
.rb-receipt-print-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  margin-bottom: 20px;
}
@media (min-width: 540px) {
  .rb-receipt-print-meta-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.rb-receipt-print-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rb-text-secondary);
}
.rb-receipt-print-value { margin-top: 2px; font-size: 14px; font-weight: 600; }
.rb-receipt-print-strong { margin-top: 4px; font-size: 15px; font-weight: 600; }
.rb-receipt-print-section { margin-top: 20px; }
.rb-receipt-print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rb-receipt-print-table th,
.rb-receipt-print-table td {
  border: 1px solid var(--rb-border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.rb-receipt-print-table thead th {
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rb-text-secondary);
}
.rb-receipt-print-table .rb-table-number { text-align: right; }
.rb-receipt-print-subtotal td { font-weight: 600; background: #f8fafc; }
.rb-receipt-print-totals {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 2px solid var(--rb-divider);
}
.rb-receipt-print-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-size: 15px;
  padding: 6px 0;
}
.rb-receipt-print-total-row.rb-receipt-print-balance {
  font-weight: 700;
  color: var(--rb-teal);
}
.rb-receipt-print-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--rb-divider);
  font-size: 14px;
  color: var(--rb-text-secondary);
  text-align: center;
}

/* One-page utility invoice layout */
.rb-invoice-utility {
  padding: 18px 22px;
  font-size: 13px;
}
.rb-invoice-park-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--rb-teal);
}
.rb-invoice-park-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--rb-text-primary);
  line-height: 1.2;
}
.rb-invoice-park-meta {
  font-size: 12px;
  color: var(--rb-text-secondary);
  line-height: 1.35;
  margin-top: 1px;
}
.rb-invoice-park-logo {
  max-height: 48px;
  max-width: 140px;
  object-fit: contain;
  display: block;
  margin-left: auto;
  margin-bottom: 6px;
}
.rb-invoice-doc-title {
  text-align: right;
  font-size: 16px;
  font-weight: 700;
  color: var(--rb-teal);
  letter-spacing: -0.01em;
}
.rb-invoice-corrected-badge {
  display: inline-block;
  margin-top: 4px;
  margin-left: auto;
  float: right;
  clear: both;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0f766e;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 2px 8px;
}
.rb-invoice-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 14px;
  margin: 0 0 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rb-border);
}
.rb-invoice-info-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rb-text-secondary);
}
.rb-invoice-info-value {
  margin-top: 1px;
  font-size: 13px;
  font-weight: 600;
  color: var(--rb-text-primary);
  line-height: 1.3;
}
.rb-invoice-charges { margin: 0 0 8px; }
.rb-invoice-charges-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rb-invoice-charges-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 4px 0;
  vertical-align: top;
}
.rb-invoice-charges-table td:last-child {
  text-align: right;
  white-space: nowrap;
  padding-left: 12px;
  font-variant-numeric: tabular-nums;
}
.rb-invoice-prior-row td { font-weight: 600; }
.rb-invoice-totals {
  margin: 8px 0 10px;
  padding-top: 8px;
  border-top: 2px solid var(--rb-divider);
  break-inside: avoid;
}
.rb-invoice-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  padding: 3px 0;
}
.rb-invoice-total-row.rb-invoice-total-due {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--rb-border);
  font-size: 16px;
  font-weight: 700;
  color: var(--rb-teal);
}
.rb-invoice-total-row.rb-invoice-credit-remaining {
  font-size: 12px;
  color: var(--rb-text-secondary);
}
.rb-invoice-usage {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--rb-border);
  break-inside: avoid;
}
.rb-invoice-usage-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px 16px;
  align-items: end;
}
.rb-invoice-usage-kv {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  padding: 2px 0;
  border-bottom: 1px solid #f1f5f9;
}
.rb-invoice-usage-kv-strong {
  font-weight: 700;
  border-bottom: none;
  margin-top: 2px;
}
.rb-invoice-usage-chart { margin: 0; }
.rb-invoice-usage-chart-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rb-text-secondary);
  margin-bottom: 4px;
}
.rb-invoice-usage-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 72px;
  border-bottom: 1px solid #cbd5e1;
  padding: 0 1px;
}
.rb-invoice-usage-bar-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.rb-invoice-usage-bar {
  width: 100%;
  max-width: 18px;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
}
.rb-invoice-usage-bar-labels {
  display: flex;
  gap: 3px;
  margin-top: 3px;
}
.rb-invoice-usage-bar-label {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 8px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rb-invoice-usage-bar-label.is-current {
  font-weight: 700;
  color: #0f766e;
}
.rb-invoice-pay-notes {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--rb-border);
}

@media print {
  @page { margin: 12mm; }
  html,
  body {
    background: #fff !important;
  }

  /* Preview modal: only print when html has this class (set by JS before print). */
  html.rb-print-doc-modal aside.rb-sidebar,
  html.rb-print-doc-modal .rb-app-topbar,
  html.rb-print-doc-modal .rb-nav-backdrop,
  html.rb-print-doc-modal .rb-sidebar--drawer,
  html.rb-print-doc-modal main.rb-main {
    display: none !important;
  }
  html.rb-print-doc-modal #rb-global-doc-backdrop {
    position: static !important;
    inset: auto !important;
    display: block !important;
    padding: 0 !important;
    background: transparent !important;
  }
  html.rb-print-doc-modal #rb-global-doc-backdrop .rb-modal {
    box-shadow: none !important;
    border: none !important;
    max-width: none !important;
    max-height: none !important;
  }
  html.rb-print-doc-modal .rb-no-print,
  html.rb-print-doc-modal .rb-doc-preview-toolbar {
    display: none !important;
  }
  html.rb-print-doc-modal #rb-doc-preview-body {
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  /* Standalone receipt/invoice page (class set on <html> before print). */
  html.rb-print-doc-page aside.rb-sidebar,
  html.rb-print-doc-page .rb-app-topbar,
  html.rb-print-doc-page .rb-nav-backdrop,
  html.rb-print-doc-page .rb-sidebar--drawer,
  html.rb-print-doc-page main.rb-main .rb-no-print {
    display: none !important;
  }
  html.rb-print-doc-page .rb-main-with-sidebar {
    margin-left: 0 !important;
  }
  html.rb-print-doc-page .rb-page-shell {
    max-width: none !important;
    padding: 0 !important;
  }

  .rb-print-sheet {
    border: none !important;
    box-shadow: none !important;
    max-width: none !important;
    padding: 0 !important;
  }
  .rb-receipt-print-header { break-after: avoid; }
  .rb-receipt-print-table,
  .rb-receipt-print-totals { break-inside: avoid; }
  .rb-invoice-utility { padding: 0 !important; }
  .rb-invoice-park-header,
  .rb-invoice-info-grid,
  .rb-invoice-totals,
  .rb-invoice-usage,
  .rb-invoice-usage-grid { break-inside: avoid; }
}

/* Documents hub (filter layout: .rb-documents-stack / .rb-documents-filter-form) */
.rb-doc-row {
  cursor: pointer;
}
.rb-doc-row:hover td {
  background: #f8fafc;
}
.rb-doc-num {
  font-weight: 600;
  color: var(--rb-teal);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.rb-doc-preview-actions .rb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--rb-radius-input);
  box-sizing: border-box;
}
.rb-doc-preview-actions .rb-btn svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}
/* Documents hub: filter card matches table width; grid aligns with results. */
.rb-documents-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 0;
}
.rb-documents-filter-card {
  overflow: hidden;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-card);
  background: var(--rb-surface);
  box-shadow: var(--rb-shadow-card);
  padding: 16px 20px;
}
.rb-documents-filter-form {
  display: grid;
  grid-template-columns: minmax(12rem, 1.4fr) minmax(10rem, 1fr) minmax(10.5rem, auto) minmax(10.5rem, auto) minmax(7.5rem, auto);
  gap: 12px 20px;
  align-items: end;
}
.rb-documents-filter-label {
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}
.rb-documents-filter-field .rb-input,
.rb-documents-filter-submit .rb-documents-search-btn {
  min-height: 40px;
  height: 40px;
  box-sizing: border-box;
}
.rb-documents-filter-submit .rb-documents-search-btn {
  width: 100%;
  min-width: 6.5rem;
}
.rb-documents-filter-submit-spacer {
  visibility: hidden;
  min-height: 14px;
  line-height: 14px;
  margin: 0;
  padding: 0;
  display: block;
}
@media (max-width: 1024px) {
  .rb-documents-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rb-documents-filter-submit {
    grid-column: 1 / -1;
  }
  .rb-documents-filter-submit .rb-documents-search-btn {
    width: auto;
    justify-self: start;
  }
}
@media (max-width: 520px) {
  .rb-documents-filter-form {
    grid-template-columns: 1fr;
  }
}

/* Reports hub: date filter (From / To / Apply) + report cards + ledger */
.rb-reports-overview-card {
  margin-bottom: 20px;
}
.rb-section-card.rb-section-card--allow-tooltips,
.rb-section-card.rb-reports-overview-card.rb-section-card--allow-tooltips {
  overflow: visible;
}
.rb-reports-overview-body {
  padding-top: 4px;
  overflow: visible;
}
.rb-reports-overview-kpi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: stretch;
}
.rb-reports-overview-kpi-grid__main,
.rb-reports-overview-kpi-grid__side {
  display: grid;
  grid-template-rows: minmax(8.5rem, 1fr) minmax(8.5rem, 1fr);
  gap: 1rem;
  min-width: 0;
}
.rb-reports-overview-kpi-grid__side-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  min-width: 0;
  align-items: stretch;
}
.rb-metric-card.rb-metric-card--overview,
.rb-kpi-link.rb-metric-card--overview {
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  min-height: 8.5rem;
  height: 100%;
  padding: 20px;
  overflow: visible;
  position: relative;
  z-index: 1;
}
.rb-kpi-link.rb-metric-card--overview {
  flex-direction: row;
  align-items: center;
}
.rb-metric-card.rb-metric-card--overview:hover,
.rb-metric-card.rb-metric-card--overview:focus-within,
.rb-kpi-link.rb-metric-card--overview:hover,
.rb-kpi-link.rb-metric-card--overview:focus-within {
  z-index: 5;
}
.rb-metric-card--overview .rb-metric-label,
.rb-metric-card--overview .rb-metric-value {
  margin: 0;
}
.rb-metric-card--overview .rb-metric-value {
  margin-top: 6px;
}
.rb-metric-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.rb-metric-stack--split {
  flex-direction: row;
  gap: 1.25rem;
}
.rb-metric-stack--split .rb-metric-stack-item {
  flex: 1 1 0;
  min-width: 0;
}
.rb-metric-stack-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  margin-top: 4px;
}
.rb-metric-value--stacked {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}
.rb-link-subtle {
  color: #0f766e;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.rb-link-subtle:hover {
  color: #115e59;
}
@media (max-width: 1100px) and (min-width: 641px) {
  .rb-reports-overview-kpi-grid {
    grid-template-columns: 1fr;
  }
  .rb-reports-overview-kpi-grid__main {
    grid-template-rows: auto;
    grid-template-columns: 1fr;
  }
  .rb-reports-overview-kpi-grid__side {
    grid-template-rows: auto;
  }
}
@media (max-width: 640px) {
  .rb-reports-overview-kpi-grid {
    grid-template-columns: 1fr;
  }
  .rb-reports-overview-kpi-grid__main,
  .rb-reports-overview-kpi-grid__side,
  .rb-reports-overview-kpi-grid__side-top {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .rb-metric-stack--split {
    flex-direction: column;
    gap: 10px;
  }
}
/* Legacy row helpers kept for older templates */
.rb-reports-overview-kpi-row {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: stretch;
}
.rb-reports-overview-kpi-row--primary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.rb-reports-overview-kpi-row--balances {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.rb-reports-overview-kpi-row .rb-metric-card,
.rb-reports-overview-kpi-row .rb-kpi-link {
  min-height: 8.5rem;
  height: 100%;
  box-sizing: border-box;
  overflow: visible;
  position: relative;
  z-index: 1;
}
.rb-reports-overview-body .rb-grid-kpi {
  margin-bottom: 1rem;
  align-items: stretch;
}
.rb-reports-overview-body .rb-grid-kpi .rb-metric-card,
.rb-reports-overview-body .rb-grid-kpi .rb-kpi-link {
  min-height: 8.5rem;
  height: 100%;
  box-sizing: border-box;
}
.rb-reports-water-chart--compact {
  margin-top: 0;
}
.rb-reports-water-chart--compact .rb-reports-water-chart-title,
.rb-reports-water-chart--compact .rb-reports-water-chart-subtitle {
  display: none;
}
.rb-reports-water-chart-empty {
  margin: 8px 0 4px;
  color: #64748b;
  font-size: 14px;
}
.rb-water-chart-point {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  pointer-events: auto;
  cursor: pointer;
  outline: none;
  box-shadow: 0 0 0 6px transparent;
}
.rb-water-chart-point.is-latest {
  background: var(--rb-point-color, #0d9488);
  border: 2px solid var(--rb-point-color, #0d9488);
}
.rb-water-chart-point.is-historical {
  background: transparent;
  border: 2px solid var(--rb-point-color, #0d9488);
}
.rb-water-chart-point:focus {
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.35);
}
.rb-water-chart-float-tip {
  position: fixed;
  z-index: 90;
  max-width: min(300px, calc(100vw - 16px));
  padding: 10px 12px;
  border-radius: var(--rb-radius-input);
  border: 1px solid var(--rb-border);
  background: var(--rb-surface);
  box-shadow: var(--rb-shadow-card);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--rb-text-primary);
  white-space: pre-line;
  pointer-events: none;
}
.rb-reports-water-chart-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--rb-text-primary);
}
.rb-reports-water-chart-subtitle {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.4;
  color: #64748b;
}
.rb-reports-water-chart-inner {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.rb-reports-water-chart-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  width: 2.75rem;
  padding: 2px 0;
  text-align: right;
  font-size: 10px;
  font-family: var(--rb-font-mono, ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
  color: #64748b;
  line-height: 1;
}
.rb-reports-water-chart-y-axis span {
  line-height: 1;
}
.rb-reports-water-chart-svg-wrap {
  min-width: 0;
  flex: 1;
}
.rb-reports-water-chart-plot {
  position: relative;
  width: 100%;
  height: 12rem;
}
.rb-reports-water-chart-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.rb-reports-water-chart-points {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.rb-reports-water-chart-gridline {
  stroke: #eef2f7;
  stroke-width: 0.25;
  vector-effect: non-scaling-stroke;
}
.rb-reports-water-chart-x-labels {
  position: relative;
  height: 2.25rem;
  margin-top: 8px;
  box-sizing: border-box;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}
.rb-reports-water-chart-x-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  max-width: 4.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
@media (max-width: 900px) {
  .rb-reports-water-chart-inner {
    flex-direction: column;
  }
  .rb-reports-water-chart-y-axis {
    flex-direction: row;
    width: 100%;
    justify-content: space-between;
    order: 2;
    margin-top: 4px;
  }
  .rb-reports-water-chart-svg-wrap {
    order: 1;
  }
}
.rb-reports-after-overview {
  margin-bottom: 20px;
}
.rb-reports-filter-form {
  grid-template-columns: minmax(10.5rem, auto) minmax(10.5rem, auto) minmax(7.5rem, auto);
}
.rb-reports-cards-section {
  margin-bottom: 20px;
}
.rb-report-hub-sections {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: 20px;
}
.rb-report-hub-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
  margin: 0 0 10px;
  padding-top: 22px;
}
.rb-report-hub-section-title:first-child {
  padding-top: 0;
}
.rb-metric-label-inline {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.rb-report-hub-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--rb-border);
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: #64748b;
  cursor: help;
  position: relative;
}
.rb-report-hub-help:hover,
.rb-report-hub-help:focus-visible {
  border-color: #99f6e4;
  color: var(--rb-teal);
}
.rb-report-hub-help:focus-visible {
  outline: 2px solid rgba(31, 157, 141, 0.45);
  outline-offset: 2px;
}
.rb-report-hub-help[data-tip]::after {
  content: attr(data-tip);
  position: fixed;
  left: var(--rb-tip-left, 0);
  bottom: var(--rb-tip-bottom, auto);
  z-index: 80;
  width: var(--rb-tip-width, min(280px, 70vw));
  max-width: min(280px, calc(100vw - 16px));
  padding: 10px 12px;
  border-radius: var(--rb-radius-input);
  border: 1px solid var(--rb-border);
  background: var(--rb-surface);
  box-shadow: var(--rb-shadow-card);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: normal;
  text-transform: none;
  color: var(--rb-text-primary);
  text-align: left;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease;
}
.rb-report-hub-help[data-tip]:hover::after,
.rb-report-hub-help[data-tip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
}
.rb-report-hub-card-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rb-report-hub-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-card);
  background: var(--rb-surface);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--rb-shadow-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
a.rb-report-hub-card:hover {
  border-color: var(--rb-teal);
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.12);
}
.rb-report-hub-card.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.rb-report-hub-card-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--rb-radius-input);
  background: #f0fdfa;
  color: var(--rb-teal);
}
.rb-report-hub-card.is-disabled .rb-report-hub-card-icon {
  background: #f1f5f9;
  color: #94a3b8;
}
.rb-report-hub-card-text {
  flex: 1 1 auto;
  min-width: 0;
}
.rb-report-hub-card-title {
  display: block;
  font-weight: 600;
  color: var(--rb-text-primary);
}
.rb-report-hub-card-desc {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.4;
}
.rb-report-hub-card-arrow {
  flex: 0 0 auto;
  color: #64748b;
}
.rb-ledger-section-card {
  margin-top: 8px;
  margin-bottom: 24px;
}
.rb-ledger-filter-form {
  grid-template-columns: minmax(12rem, 1.4fr) minmax(10.5rem, auto) minmax(10.5rem, auto);
  margin-bottom: 16px;
}
.rb-ledger-results {
  position: relative;
  min-height: 2rem;
}
.rb-ledger-results.is-loading {
  opacity: 0.55;
  pointer-events: none;
}
.rb-ledger-results.is-loading::after {
  content: "Loading ledger…";
  position: absolute;
  left: 0;
  top: 0.25rem;
  font-size: 13px;
  color: var(--rb-text-muted, #64748b);
}
.rb-ledger-doc-link {
  font-weight: 500;
}
.rb-ledger-table-wrap {
  margin-top: 4px;
}
.rb-ledger-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.rb-ledger-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.rb-ledger-page-label {
  font-size: 13px;
}
.rb-ledger-print-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
span.rb-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}
@media (max-width: 1024px) {
  .rb-reports-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rb-reports-filter-form .rb-documents-filter-submit {
    grid-column: 1 / -1;
  }
  .rb-ledger-filter-form {
    grid-template-columns: 1fr 1fr;
  }
  .rb-ledger-filter-form .rb-documents-filter-submit {
    grid-column: 1 / -1;
  }
}
@media (max-width: 520px) {
  .rb-reports-filter-form {
    grid-template-columns: 1fr;
  }
  .rb-ledger-filter-form {
    grid-template-columns: 1fr;
  }
}

/* Review readings: reading choice rows (no naked radios). */
.rb-review-reading-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rb-review-reading-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-input);
  background: #f8fafc;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.35;
}
.rb-review-reading-option:has(input:disabled) {
  cursor: default;
  opacity: 0.92;
}
.rb-review-reading-option input[type="radio"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--rb-teal);
}
.rb-review-reading-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-align: left;
}
.rb-review-reading-value-line {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}
.rb-review-reading-meta {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  color: var(--rb-text-secondary);
  font-weight: 400;
  font-family: var(--rb-font-sans);
}
.rb-review-other-readings {
  margin-top: 8px;
  padding: 0 0 0 12px;
  border-left: 2px solid var(--rb-divider);
}
.rb-review-other-readings summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--rb-teal);
}
.rb-review-other-readings summary::-webkit-details-marker {
  display: none;
}
.rb-modal-review-unlock {
  max-width: min(520px, calc(100vw - 48px));
}
.rb-review-unlock-backdrop {
  z-index: 70;
}

/* Setup wizard (server-rendered, no app shell sidebar) */
.rb-setup-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px 48px;
  background: #f8fafc;
}
.rb-setup-shell {
  width: 100%;
  max-width: 32rem;
}
.rb-setup-brand {
  text-align: center;
  margin-bottom: 20px;
}
.rb-setup-brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--rb-text-primary);
}
.rb-setup-brand-sub {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}
.rb-setup-card {
  max-width: 500px;
  margin: 0 auto;
}
.rb-setup-step {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
}
.rb-setup-title {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--rb-text-primary);
  line-height: 1.25;
}
.rb-setup-subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #64748b;
}
.rb-setup-form-grid {
  gap: 16px;
  margin-top: 20px;
}
.rb-setup-actions {
  margin-top: 24px;
}
.rb-setup-actions-split {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
}
/* Setup wizard — Lots / Units (compact inline rows) */
.rb-setup-units-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.rb-setup-units-add-head {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--rb-text-primary);
}
/* Lots / Units setup: one horizontal line per form (override global .rb-input { width: 100% }). */
.rb-setup-units-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex-wrap: nowrap;
  min-width: 0;
  box-sizing: border-box;
}
.rb-setup-units-row input[type="text"].rb-input,
.rb-setup-units-row input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  max-width: none;
}
.rb-setup-units-row button {
  flex: 0 0 auto;
  white-space: nowrap;
}
.rb-setup-units-add-help {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--rb-text-muted);
}
.rb-setup-units-divider {
  margin: 10px 0 6px;
  border: 0;
  border-top: 1px solid var(--rb-divider);
}
.rb-setup-units-existing-head {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--rb-text-primary);
}
.rb-setup-units-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.rb-setup-units-item {
  padding: 10px 12px;
  border-radius: var(--rb-radius-input);
  background: #f8fafc;
}
.rb-setup-footer-note {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
}

/* Water rate schedule modal — inline validation */
.rb-wbc-modal-banner-error {
  border-radius: var(--rb-radius-input);
  border: 1px solid #fecaca;
  background: var(--rb-danger-bg);
  color: #991b1b;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 500;
}
.rb-wbc-modal-inline-error {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--rb-danger);
}
.rb-wbc-tiers--has-error .rb-wbc-tier-table {
  border-radius: var(--rb-radius-input);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35);
}

/* Property Import guided UX */
.rb-import-analyze-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rb-import-analyze-steps li { padding: 8px 12px; border-radius: 8px; background: #f8fafc; border: 1px solid #e2e8f0; color: #64748b; font-size: 14px; }
.rb-import-analyze-steps li.is-queued { color: #94a3b8; }
.rb-import-analyze-steps li.is-current { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; font-weight: 600; }
.rb-import-analyze-steps li.is-current::before { content: "… "; }
.rb-import-analyze-steps li.is-visited { background: #f8fafc; color: #64748b; }
.rb-import-analyze-steps li.is-pending { background: #f8fafc; }
.rb-import-analyze-steps li.is-complete { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.rb-import-analyze-steps li.is-complete::before { content: "✓ "; }
.rb-import-summary-box { padding: 14px 16px; border: 1px solid #e2e8f0; border-radius: var(--rb-radius-card); background: #f8fafc; }
.rb-import-sheet-card { padding: 14px 16px; border: 1px solid #e2e8f0; border-radius: var(--rb-radius-card); background: #fff; }
.rb-import-status-good { background: #f0fdf4; }
.rb-import-status-warn { background: #fffbeb; }
.rb-import-status-bad { background: #fef2f2; }
span.rb-import-status-good, span.rb-import-status-warn, span.rb-import-status-bad { background: transparent; font-weight: 600; font-size: 13px; }
span.rb-import-status-good { color: #047857; }
span.rb-import-status-warn { color: #b45309; }
span.rb-import-status-bad { color: #b91c1c; }
.rb-import-confirm { border: 1px solid #fde68a; border-radius: var(--rb-radius-card); }
.rb-import-month-group { padding: 12px; border: 1px solid #bbf7d0; border-radius: var(--rb-radius-card); background: #f0fdf4; }
.rb-import-stage-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.rb-import-stage-card { padding: 14px; border: 1px solid #e2e8f0; border-radius: var(--rb-radius-card); background: #fff; }

/* Import mini-wizard presentation */
.rb-import-wizard-card {
  padding: 28px 28px 32px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  max-width: 40rem;
}
.rb-import-wizard-question {
  font-size: 1.35rem;
  line-height: 1.35;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin: 0 0 12px;
}
.rb-import-choice-stack { display: flex; flex-direction: column; gap: 10px; }
.rb-import-choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.rb-import-choice:has(input:checked) {
  border-color: #93c5fd;
  background: #eff6ff;
}
.rb-import-choice input { margin-top: 3px; }
.rb-import-signal-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 14px;
}
.rb-import-mapping-compare {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  margin-bottom: 8px;
}
@media (max-width: 720px) {
  .rb-import-mapping-compare { grid-template-columns: 1fr; }
  .rb-import-mapping-arrow { transform: none; text-align: left; }
}
.rb-import-mapping-arrow {
  padding-top: 28px;
  color: #94a3b8;
  font-size: 18px;
  text-align: center;
}
.rb-import-map-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 14px;
}
.rb-import-map-list li {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
}
.rb-import-uncertain-map summary {
  cursor: pointer;
  list-style: none;
}
.rb-import-advanced {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
}
.rb-import-advanced > summary {
  cursor: pointer;
  font-weight: 600;
  color: #475569;
  font-size: 13px;
}
.rb-import-thinking { position: relative; overflow: hidden; }
.rb-import-thinking-pulse {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(147, 197, 253, 0.18), transparent);
  transform: translateX(-100%);
  animation: rb-import-shimmer 1.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes rb-import-shimmer {
  100% { transform: translateX(100%); }
}
.rb-import-dots::after {
  content: "";
  animation: rb-import-dots 1.2s steps(4, end) infinite;
}
@keyframes rb-import-dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}
/* Soft segmented control (utility rates, meters, documents). Later rules must not
   reintroduce a bordered “three buttons” look on .rb-segmented. */
.rb-segmented {
  display: flex;
  flex: 1;
  gap: 4px;
  border: none;
  border-radius: 12px;
  background: #f1f5f9;
  padding: 5px;
  font-size: 14px;
  font-weight: 600;
  min-width: 12rem;
  max-width: 40rem;
  overflow: visible;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25);
}
.rb-segment {
  flex: 1;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font: inherit;
  line-height: 1.25;
  text-align: center;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
a.rb-segment {
  text-decoration: none;
  box-sizing: border-box;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rb-segment:hover { color: #334155; }
.rb-segment.is-active {
  background: var(--rb-teal);
  color: #fff;
  box-shadow: var(--rb-shadow-card);
}
.rb-segment:focus-visible {
  outline: 2px solid var(--rb-teal);
  outline-offset: 2px;
}
.rb-segment.is-active:focus-visible {
  outline-color: #fff;
  outline-offset: 2px;
  box-shadow: var(--rb-shadow-card), 0 0 0 2px var(--rb-teal);
}
@media (max-width: 640px) {
  .rb-segmented { max-width: 100%; }
  .rb-segment { padding: 10px 10px; font-size: 13px; }
}

/* Utility Rate Assistant proposal filters — reuse segment active teal. */
.ura-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.ura-filter-chip {
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.ura-filter-chip:hover { color: #334155; background: rgba(255, 255, 255, 0.55); }
.ura-filter-chip.is-active {
  background: var(--rb-teal);
  color: #fff;
  box-shadow: var(--rb-shadow-card);
}
.ura-filter-chip:focus-visible {
  outline: 2px solid var(--rb-teal);
  outline-offset: 2px;
}
.ura-filter-chip.is-active:focus-visible {
  outline-color: #fff;
  outline-offset: 2px;
  box-shadow: var(--rb-shadow-card), 0 0 0 2px var(--rb-teal);
}
.ura-filter-action {
  /* Select all / Clear all — never persist as active chips */
}
.ura-quiet-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--rb-teal);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.ura-quiet-link:hover { color: var(--rb-teal-hover); }
.ura-quiet-link:focus-visible {
  outline: 2px solid var(--rb-teal);
  outline-offset: 2px;
  border-radius: 2px;
}
/* Import History overflow menus must escape card clipping */
.rb-section-card.rb-section-card--allow-menu {
  overflow: visible;
  position: relative;
}
.rb-section-card.rb-section-card--allow-menu:has(details[open]) {
  z-index: 40;
}
.rb-import-history-menu-details {
  position: relative;
}
.rb-import-history-menu-details > summary {
  list-style: none;
}
.rb-import-history-menu-details > summary::-webkit-details-marker {
  display: none;
}
.rb-import-history-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--rb-border);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  z-index: 50;
}
.rb-import-history-nav {
  flex-shrink: 0;
}
.rb-hidden { display: none !important; }
.rb-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Bulk reading-decision review on import preview */
.rb-reading-decisions-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.rb-reading-decision-table th,
.rb-reading-decision-table td {
  padding: 8px 12px;
  font-size: 13px;
  vertical-align: middle;
}
.rb-reading-decision-segment {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: #f1f5f9;
}
.rb-reading-decision-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-height: 32px;
  min-width: 64px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  user-select: none;
}
.rb-reading-decision-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.rb-reading-decision-option.is-active {
  background: var(--rb-teal);
  color: #fff;
  box-shadow: var(--rb-shadow-card);
}
.rb-reading-decision-option:focus-within {
  outline: 2px solid var(--rb-teal);
  outline-offset: 1px;
}
@media (max-width: 720px) {
  .rb-reading-decision-table thead {
    display: none;
  }
  .rb-reading-decision-table,
  .rb-reading-decision-table tbody,
  .rb-reading-decision-table tr,
  .rb-reading-decision-table td {
    display: block;
    width: 100%;
  }
  .rb-reading-decision-row {
    padding: 10px 12px;
    border-top: 1px solid var(--rb-divider);
  }
  .rb-reading-decision-table td {
    border-top: none;
    padding: 4px 0;
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 8px;
    align-items: center;
  }
  .rb-reading-decision-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .rb-reading-decision-table td[data-label="Decision"] {
    grid-template-columns: 1fr;
    margin-top: 6px;
  }
  .rb-reading-decision-table td[data-label="Decision"]::before {
    display: none;
  }
  .rb-reading-decision-segment {
    width: 100%;
  }
  .rb-reading-decision-option {
    flex: 1;
    min-height: 40px;
  }
}

/* Tenant wizard validation */
.rb-field-invalid,
input.rb-field-invalid,
select.rb-field-invalid {
  border-color: #b91c1c !important;
  box-shadow: 0 0 0 1px rgba(185, 28, 28, 0.25);
}

/* ----- Setup Assistant: desktop checklist column + tablet/mobile checklist drawer ----- */
.rb-setup-two-col {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.rb-setup-main-col {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.rb-setup-section-actions {
  border-top: 1px solid var(--rb-divider);
}
.rb-setup-checklist-open {
  display: none;
}
.rb-setup-checklist-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--rb-nav-z-backdrop) + 5);
  background: rgba(15, 23, 42, 0.4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}
.rb-setup-checklist-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.rb-setup-checklist-backdrop[hidden] { display: none !important; }
.rb-setup-checklist-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 92vw);
  z-index: calc(var(--rb-nav-z-drawer) + 5);
  background: var(--rb-surface);
  color: var(--rb-text-primary);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  transform: translateX(105%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 180ms ease, visibility 180ms ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.rb-setup-checklist-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}
.rb-setup-checklist-drawer[hidden] { display: none !important; }
.rb-setup-checklist-drawer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rb-border);
  flex-shrink: 0;
}
.rb-setup-checklist-drawer-title {
  font-size: 14px;
  font-weight: 650;
}
.rb-setup-checklist-drawer-body {
  padding: 14px;
  overflow-y: auto;
  display: grid;
  gap: 10px;
  min-height: 0;
}
@media (min-width: 1024px) {
  .rb-setup-two-col {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .rb-setup-checklist-open,
  .rb-setup-checklist-backdrop,
  .rb-setup-checklist-drawer {
    display: none !important;
  }
}
@media (max-width: 1023px) {
  .rb-setup-checklist-desktop {
    display: none !important;
  }
  .rb-setup-checklist-open {
    display: inline-flex;
  }
}
@media (max-width: 640px) {
  .rb-setup-units-row {
    flex-wrap: wrap;
  }
  .rb-setup-units-row button {
    width: 100%;
  }
  .rb-form-row {
    grid-template-columns: 1fr;
  }
}


/* ===== Empty states / management lists (Messages, Maintenance, Insurance, Announcements) ===== */
.rb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 36px 20px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--rb-radius-card);
  background: #f8fafc;
}
.rb-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #ecfdf5;
  color: #0f766e;
}
.rb-empty-icon svg { width: 22px; height: 22px; }
.rb-empty-title {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--rb-text-primary);
}
.rb-empty-subtitle {
  margin: 0;
  max-width: 28rem;
  font-size: 14px;
  line-height: 20px;
  color: var(--rb-text-secondary);
}
.rb-empty-actions { margin-top: 8px; }

.rb-mgmt-row {
  display: grid;
  gap: 8px 16px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rb-divider);
  text-decoration: none;
  color: inherit;
  transition: background-color 120ms ease;
}
a.rb-mgmt-row:hover { background: #f8fafc; }
.rb-mgmt-row.is-unread { background: #f0fdfa; }
.rb-mgmt-row.is-unread:hover { background: #e6fffa; }
.rb-mgmt-row-main { min-width: 0; }
.rb-mgmt-row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--rb-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rb-mgmt-row-meta {
  margin-top: 2px;
  font-size: 13px;
  color: var(--rb-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rb-mgmt-row-side {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
@media (min-width: 768px) {
  .rb-mgmt-row {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr) auto auto;
  }
}

.rb-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rb-chat-bubble {
  max-width: min(36rem, 92%);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}
.rb-chat-bubble.is-staff {
  align-self: flex-end;
  background: #f0fdfa;
  border-color: #99f6e4;
}
.rb-chat-bubble.is-resident { align-self: flex-start; }
.rb-chat-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--rb-text-secondary);
  margin-bottom: 4px;
}
.rb-chat-body {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.45;
  color: var(--rb-text-primary);
}

/* Staff resident-message inbox */
.rb-inbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.rb-inbox-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 16rem;
  max-width: 36rem;
}
.rb-inbox-search .rb-input {
  flex: 1 1 12rem;
  min-width: 0;
}
.rb-inbox-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rb-divider);
  background: #f1f5f9;
}
.rb-inbox-row.is-unread {
  background: #fff;
}
.rb-inbox-row:hover {
  filter: brightness(0.985);
}
.rb-inbox-row-link {
  display: block;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.rb-inbox-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.rb-inbox-identity {
  font-size: 13px;
  color: var(--rb-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rb-inbox-row.is-unread .rb-inbox-identity {
  font-weight: 700;
  color: var(--rb-text-primary);
}
.rb-inbox-subject {
  font-size: 14px;
  font-weight: 400;
  color: var(--rb-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rb-inbox-row.is-unread .rb-inbox-subject {
  font-weight: 700;
}
.rb-inbox-preview {
  margin-top: 4px;
  font-size: 13px;
  color: var(--rb-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rb-inbox-row.is-unread .rb-inbox-preview {
  font-weight: 600;
  color: var(--rb-text-primary);
}
.rb-inbox-time {
  font-size: 12px;
  color: var(--rb-text-secondary);
  flex-shrink: 0;
  white-space: nowrap;
}
.rb-inbox-row.is-unread .rb-inbox-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--rb-text-primary);
}
.rb-inbox-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 2px;
}
@media (max-width: 640px) {
  .rb-inbox-row {
    grid-template-columns: 1fr;
  }
  .rb-inbox-row-actions {
    justify-content: flex-start;
  }
}

.rb-table-row-link { cursor: pointer; }
.rb-table-row-link:hover td { background: #f8fafc; }
.rb-table-row-link.is-unread td { background: #f0fdfa; }

.rb-page-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
}
.rb-page-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  color: var(--rb-text-secondary);
}
.rb-page-stat strong {
  font-size: 16px;
  color: var(--rb-text-primary);
}

/* Inline Resident Portal access inside Lease Contacts */
.rb-portal-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--rb-divider, #e2e8f0);
}
.rb-portal-inline-main { min-width: 0; flex: 1 1 200px; }
.rb-portal-inline-status {
  font-size: 13px;
  color: var(--rb-text-secondary);
  line-height: 1.4;
}
.rb-portal-inline-label { font-weight: 600; color: var(--rb-text-primary); }
.rb-portal-inline-value { font-weight: 500; }
.rb-portal-inline-error {
  margin-top: 4px;
  font-size: 12px;
  color: #b45309;
}
.rb-portal-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
@media (max-width: 640px) {
  .rb-portal-inline { flex-direction: column; align-items: stretch; }
  .rb-portal-inline-actions { justify-content: flex-start; }
  .rb-portal-inline-actions .rb-btn { width: 100%; justify-content: center; }
}
