/* PG STAy — admin + tenant portal app shell. Mobile-first. */

.pg-shell { min-height: 100vh; background: var(--pg-bg); }

/* ---------- Sidebar ---------- */
.pg-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  max-width: 84vw;
  background: var(--pg-card);
  border-right: 1px solid var(--pg-border);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  overflow-y: auto;
}
.pg-shell.is-nav-open .pg-sidebar { transform: translateX(0); }
.pg-sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(15, 12, 40, 0.45); z-index: 55;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.pg-shell.is-nav-open .pg-sidebar-backdrop { opacity: 1; pointer-events: auto; }

.pg-brand { display: flex; align-items: center; gap: 10px; padding: var(--pg-space-5) var(--pg-space-4); }
.pg-brand-mark {
  width: 42px; height: 42px; border-radius: var(--pg-radius-sm); background: var(--pg-primary-gradient);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
}
.pg-brand-mark svg { width: 22px; height: 22px; stroke: #fff; }
.pg-brand-mark:has(.pg-brand-logo) { background: var(--pg-card); border: 1px solid var(--pg-border); }
.pg-brand-logo { width: 100%; height: 100%; object-fit: cover; }
.pg-brand-text strong { display: block; font-size: 1.05rem; }
.pg-brand-text span { display: block; font-size: 0.72rem; color: var(--pg-text-faint); }

.pg-nav { flex: 1; padding: var(--pg-space-2) var(--pg-space-3); display: flex; flex-direction: column; gap: 2px; }
.pg-nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--pg-radius-sm);
  font-size: 0.88rem; font-weight: 600; color: var(--pg-text-muted);
}
.pg-nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.pg-nav-item:hover { background: var(--pg-primary-50); color: var(--pg-primary); }
.pg-nav-item.is-active { background: var(--pg-primary-gradient); color: #fff; box-shadow: var(--pg-shadow-sm); }
.pg-nav-item-button { border: none; background: transparent; text-align: left; width: 100%; }
.pg-nav-badge {
  margin-left: auto; flex-shrink: 0; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--pg-danger); color: #fff; border-radius: var(--pg-radius-full);
  font-size: 0.66rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.pg-nav-item.is-active .pg-nav-badge { background: rgba(255, 255, 255, 0.28); }
.pg-brand:hover { background: var(--pg-bg); }

.pg-sidebar-foot { padding: var(--pg-space-4); border-top: 1px solid var(--pg-border); display: flex; flex-direction: column; gap: var(--pg-space-3); }
.pg-property-chip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--pg-radius-sm); background: var(--pg-bg); font-size: 0.78rem; }
.pg-property-chip > div { flex: 1; min-width: 0; }
.pg-property-chip strong { display: block; font-size: 0.82rem; }
.pg-property-chip span { color: var(--pg-text-faint); }
.pg-property-chip-logo { width: 20px; height: 20px; flex-shrink: 0; border-radius: 4px; object-fit: cover; }

/* Tenant portal uses the same white sidebar + purple active-pill skin as admin (no override needed). */

.pg-due-card { padding: var(--pg-space-4); border-radius: var(--pg-radius-md); background: var(--pg-primary-50); }
.pg-due-card span { font-size: 0.74rem; color: var(--pg-text-faint); }
.pg-due-card strong { display: block; font-size: 1.2rem; margin: 2px 0 10px; }

/* ---------- Main column ---------- */
.pg-main { min-height: 100vh; padding-bottom: calc(var(--pg-tabbar-h) + var(--pg-space-4)); }

.pg-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center;
  height: var(--pg-topbar-h); padding: 0 var(--pg-space-4);
  background: var(--pg-card); border-bottom: 1px solid var(--pg-border);
}
.pg-topbar-inner { display: flex; align-items: center; gap: var(--pg-space-3); width: 100%; max-width: var(--pg-content-max); }
.pg-nav-toggle { border: none; background: transparent; padding: 8px; border-radius: var(--pg-radius-sm); flex-shrink: 0; }
.pg-nav-toggle:hover { background: var(--pg-bg); }
.pg-nav-toggle svg { width: 22px; height: 22px; }
.pg-topbar-title { font-size: 1.05rem; font-weight: 700; flex: 1; }
.pg-search {
  display: none; align-items: center; gap: 8px; flex: 1; max-width: 380px;
  background: var(--pg-bg); border: 1px solid var(--pg-border); border-radius: var(--pg-radius-sm);
  padding: 8px 12px;
}
.pg-search svg { width: 16px; height: 16px; color: var(--pg-text-faint); flex-shrink: 0; }
.pg-toolbar-search {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--pg-bg); border: 1px solid var(--pg-border); border-radius: var(--pg-radius-sm);
  padding: 8px 12px;
}
.pg-toolbar-search svg { width: 16px; height: 16px; color: var(--pg-text-faint); flex-shrink: 0; }
.pg-toolbar-search input { background: transparent; border: none; outline: none; width: 100%; font-size: 0.84rem; }
.pg-search input { background: transparent; border: none; outline: none; width: 100%; font-size: 0.84rem; }
.pg-icon-btn { position: relative; border: none; background: transparent; padding: 8px; border-radius: var(--pg-radius-sm); flex-shrink: 0; margin-left: auto; }
.pg-icon-btn:hover { background: var(--pg-bg); }
.pg-icon-btn svg { width: 20px; height: 20px; }
.pg-icon-btn-text { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; font-size: 1.1rem; line-height: 1; font-weight: 700; color: var(--pg-text-muted); }
.pg-icon-btn-text:disabled { opacity: 0.35; cursor: not-allowed; }

.pg-photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pg-space-3); }
.pg-photo-tile { border: 1px solid var(--pg-border); border-radius: var(--pg-radius-md); overflow: hidden; }
.pg-photo-tile.is-disabled { opacity: 0.55; }
.pg-photo-tile-img { position: relative; }
.pg-photo-tile-img img { width: 100%; height: 110px; object-fit: cover; display: block; }
.pg-photo-tile-badge { position: absolute; top: 6px; right: 6px; }
.pg-photo-tile-body { padding: var(--pg-space-2) var(--pg-space-3) var(--pg-space-3); }
.pg-photo-tile-caption { font-size: 0.82rem; font-weight: 600; margin-bottom: var(--pg-space-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-photo-tile-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
@media (min-width: 640px) {
  .pg-photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .pg-photo-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* A `.pg-select` inside a flex row of icon buttons (e.g. a table row's action cell) can shrink
   down to its min-content width, which for a <select> collapses to just the dropdown arrow —
   hiding the selected option's label entirely. Keep it readable and un-shrinkable there. */
.pg-table-inline-select { flex-shrink: 0; width: auto; min-width: 132px; padding: 8px 10px; font-size: 0.82rem; }
.pg-icon-btn .pg-dot-badge {
  position: absolute; top: 4px; right: 4px; min-width: 15px; height: 15px; padding: 0 3px;
  background: var(--pg-danger); color: #fff; border-radius: var(--pg-radius-full);
  font-size: 0.62rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.pg-user { display: flex; align-items: center; gap: 8px; border: none; background: transparent; padding: 4px; border-radius: var(--pg-radius-sm); cursor: pointer; font: inherit; color: inherit; }
.pg-user:hover { background: var(--pg-bg); }
.pg-user-meta { display: none; flex-direction: column; line-height: 1.2; text-align: left; }
.pg-user-meta strong { font-size: 0.82rem; }
.pg-user-meta span { font-size: 0.72rem; color: var(--pg-text-faint); }

/* ---------- Header dropdowns & search ---------- */
.pg-dropdown { position: relative; }
.pg-search-wrap { position: relative; display: none; flex: 1; max-width: 380px; }
.pg-search-wrap .pg-search { width: 100%; max-width: none; }
.pg-search-wrap + .pg-dropdown { margin-left: auto; }
.pg-search-close { display: none; }

.pg-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 10px); right: 0;
  width: max-content; min-width: 260px; max-width: min(340px, calc(100vw - 24px));
  background: var(--pg-card); border: 1px solid var(--pg-border); border-radius: var(--pg-radius-md);
  box-shadow: var(--pg-shadow); z-index: 70; max-height: 70vh; overflow-y: auto;
}
.pg-dropdown-menu.is-open { display: block; }
.pg-dropdown-head { padding: 12px 16px; font-weight: 700; font-size: 0.84rem; border-bottom: 1px solid var(--pg-border); position: sticky; top: 0; background: var(--pg-card); }
.pg-dropdown-list { display: flex; flex-direction: column; }
.pg-dropdown-list .pg-list-item { padding: 10px 16px; }
.pg-date-range-form { padding: var(--pg-space-4); min-width: 220px; }
.pg-dropdown-foot { border-top: 1px solid var(--pg-border); }
.pg-list-item-button { width: 100%; border: none; background: transparent; text-align: left; cursor: pointer; font: inherit; color: inherit; padding: 0; }

.pg-search-results { left: 0; right: 0; width: 100%; max-width: none; min-width: 0; }

@media (max-width: 767px) {
  .pg-dropdown-menu:not(.pg-search-results) {
    position: fixed; left: 12px; right: 12px; top: calc(var(--pg-topbar-h) + 8px);
    width: auto; max-width: none; min-width: 0;
  }

  .pg-topbar-inner.is-mobile-search-open { position: relative; }
  .pg-topbar-inner.is-mobile-search-open > *:not(.pg-search-wrap) { display: none; }
  .pg-topbar-inner.is-mobile-search-open .pg-search-wrap {
    display: flex; align-items: center; gap: 8px; position: absolute; inset: 0;
    background: var(--pg-card); max-width: none;
  }
  .pg-topbar-inner.is-mobile-search-open .pg-search { display: flex; flex: 1; max-width: none; }
  .pg-topbar-inner.is-mobile-search-open .pg-search-close { display: flex; }
}

.pg-content { padding: var(--pg-space-4); max-width: var(--pg-content-max); }

.pg-page-head { display: flex; flex-direction: column; gap: var(--pg-space-3); margin-bottom: var(--pg-space-5); }
.pg-page-head h1 { font-size: 1.3rem; }
.pg-breadcrumb { font-size: 0.8rem; color: var(--pg-text-faint); }
.pg-breadcrumb a { color: var(--pg-primary); font-weight: 600; }
.pg-page-actions { display: flex; gap: var(--pg-space-2); flex-wrap: wrap; }

/* ---------- Stat cards ---------- */
.pg-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--pg-space-3); margin-bottom: var(--pg-space-5); }
/* Grid areas place the value beside the icon regardless of blade source order (icon, label,
   value, foot) — lets every page reusing this card pick up the layout with no markup changes. */
.pg-stat-card {
  display: grid; grid-template-columns: auto 1fr; column-gap: var(--pg-space-3); row-gap: 2px;
  grid-template-areas: "icon value" "label label" "foot foot";
  background: var(--pg-card); border: 1px solid var(--pg-border); border-radius: var(--pg-radius-md); padding: var(--pg-space-4);
}
a.pg-stat-card { transition: box-shadow 0.15s ease, border-color 0.15s ease; }
a.pg-stat-card:hover { box-shadow: var(--pg-shadow-sm); border-color: var(--pg-primary-light); }
.pg-stat-icon { width: 40px; height: 40px; border-radius: var(--pg-radius-sm); display: flex; align-items: center; justify-content: center; margin-bottom: var(--pg-space-3); }
.pg-stat-card .pg-stat-icon { grid-area: icon; align-self: center; margin-bottom: 0; }
.pg-stat-icon svg { width: 20px; height: 20px; }
.pg-stat-icon.is-primary { background: var(--pg-primary-50); color: var(--pg-primary); }
.pg-stat-icon.is-success { background: var(--pg-success-bg); color: var(--pg-success); }
.pg-stat-icon.is-warning { background: var(--pg-warning-bg); color: var(--pg-warning); }
.pg-stat-icon.is-danger  { background: var(--pg-danger-bg); color: var(--pg-danger); }
.pg-stat-icon.is-info    { background: var(--pg-info-bg); color: var(--pg-info); }
.pg-stat-icon.is-purple  { background: var(--pg-purple-bg); color: var(--pg-purple); }
.pg-stat-label { font-size: 0.78rem; color: var(--pg-text-faint); margin-bottom: 2px; }
.pg-stat-card .pg-stat-label { grid-area: label; margin-top: var(--pg-space-2); margin-bottom: 0; }
.pg-stat-value { font-size: 1.35rem; font-weight: 800; }
.pg-stat-card .pg-stat-value { grid-area: value; align-self: center; justify-self: start; }
.pg-stat-foot { font-size: 0.76rem; color: var(--pg-text-faint); margin-top: 6px; }
.pg-stat-card .pg-stat-foot { grid-area: foot; margin-top: 4px; }
.pg-stat-foot a { color: var(--pg-primary); font-weight: 600; }
.pg-stat-trend { font-weight: 700; }
.pg-stat-trend.is-up { color: var(--pg-success); }
.pg-stat-trend.is-down { color: var(--pg-danger); }

/* ---------- Grid / two-column layouts ---------- */
.pg-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--pg-space-4); }
.pg-grid-main-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--pg-space-4); }
.pg-stack { display: flex; flex-direction: column; gap: var(--pg-space-4); }

/* ---------- List toolbar ---------- */
.pg-toolbar { display: flex; flex-direction: column; gap: var(--pg-space-3); padding: var(--pg-space-4); border-bottom: 1px solid var(--pg-border); }
.pg-toolbar-row { display: flex; gap: var(--pg-space-2); flex-wrap: wrap; }
.pg-toolbar .pg-select { width: auto; flex: 1; min-width: 130px; }

/* ---------- List rows (mobile card list, becomes table on desktop) ---------- */
.pg-list-item {
  display: flex; align-items: center; gap: var(--pg-space-3); padding: var(--pg-space-3) var(--pg-space-4);
  border-bottom: 1px solid var(--pg-border);
}
.pg-list-item:last-child { border-bottom: none; }
a.pg-list-item:hover, button.pg-list-item:hover { background: var(--pg-bg); }
.pg-list-item.is-disabled { color: var(--pg-text-faint); cursor: not-allowed; }
.pg-list-item.is-disabled:hover { background: none; }
.pg-list-item.is-disabled .pg-list-item-title { color: var(--pg-text-faint); }
button.pg-list-item.is-active { background: var(--pg-primary-50); }
.pg-list-item.is-active .pg-list-item-title { color: var(--pg-primary); }
.pg-property-active-check { width: 18px; height: 18px; color: var(--pg-primary); }
.pg-list-item-body { flex: 1; min-width: 0; }
.pg-list-item-title { font-weight: 700; font-size: 0.88rem; }
.pg-list-item-sub { font-size: 0.78rem; color: var(--pg-text-faint); }
.pg-list-item-end { text-align: right; flex-shrink: 0; }
.pg-list-item-end-sub { font-size: 0.78rem; color: var(--pg-text-faint); }
.pg-list-item-wrap { flex-wrap: wrap; }
.pg-list-item-wrap .pg-list-item-body { flex-basis: 0; min-width: 140px; }
.pg-list-item-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--pg-space-2);
  flex: 1 0 100%; margin-top: var(--pg-space-2); padding-left: calc(34px + var(--pg-space-3));
}
@media (min-width: 640px) {
  .pg-list-item-actions { flex: 0 0 auto; margin-top: 0; padding-left: 0; }
}
.pg-card-title-row { display: flex; align-items: center; justify-content: space-between; }
.pg-stat-icon-sm { width: 34px; height: 34px; margin-bottom: 0; }

/* Data list renders as cards on mobile, as a table on desktop via [data-view] toggling */
.pg-data-table-cards { display: flex; flex-direction: column; }
.pg-data-table { display: none; }

/* ---------- Tabs ---------- */
.pg-tabs { display: flex; gap: var(--pg-space-1); overflow-x: auto; border-bottom: 1px solid var(--pg-border); padding: 0 var(--pg-space-4); -webkit-overflow-scrolling: touch; }
.pg-tab {
  padding: 12px 14px; font-size: 0.84rem; font-weight: 600; color: var(--pg-text-faint);
  border-bottom: 2px solid transparent; white-space: nowrap; flex-shrink: 0;
}
.pg-tab.is-active { color: var(--pg-primary); border-bottom-color: var(--pg-primary); }
.pg-subtabs { display: flex; flex-direction: column; gap: 2px; }
.pg-subtab { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--pg-radius-sm); font-size: 0.84rem; font-weight: 600; color: var(--pg-text-muted); }
.pg-subtab.is-active { background: var(--pg-primary-50); color: var(--pg-primary); }
.pg-subtabs-divider { height: 1px; background: var(--pg-border); margin: var(--pg-space-2) 4px; }

/* ---------- Bottom mobile tab bar ---------- */
.pg-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: var(--pg-tabbar-h); background: var(--pg-card); border-top: 1px solid var(--pg-border);
  display: flex; align-items: stretch; padding-bottom: env(safe-area-inset-bottom);
}
.pg-tabbar-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 0.66rem; font-weight: 600; color: var(--pg-text-faint); }
.pg-tabbar-item svg { width: 21px; height: 21px; }
.pg-tabbar-item.is-active { color: var(--pg-primary); }
.pg-tabbar-item.is-home svg {
  width: 40px; height: 40px; padding: 9px; border-radius: 50%; background: var(--pg-primary-gradient); color: #fff;
  margin-top: -22px; box-shadow: var(--pg-shadow);
}

.pg-fab {
  position: fixed; right: var(--pg-space-4); bottom: calc(var(--pg-tabbar-h) + var(--pg-space-3));
  width: 52px; height: 52px; border-radius: 50%; background: var(--pg-primary-gradient); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--pg-shadow); z-index: 45; border: none;
}
.pg-fab svg { width: 24px; height: 24px; }

/* ---------- Bar chart (discrete height steps, no inline styles) ---------- */
.pg-bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; }
.pg-bar-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; }
.pg-bar-chart-track { flex: 1; width: 100%; max-width: 26px; display: flex; align-items: flex-end; }
.pg-bar-chart-fill { width: 100%; border-radius: 6px 6px 0 0; background: var(--pg-primary-gradient); min-height: 4px; }
.pg-bar-chart-col span { font-size: 0.68rem; color: var(--pg-text-faint); }
.pg-bar-h-0 { height: 2%; } .pg-bar-h-5 { height: 5%; } .pg-bar-h-10 { height: 10%; } .pg-bar-h-15 { height: 15%; }
.pg-bar-h-20 { height: 20%; } .pg-bar-h-25 { height: 25%; } .pg-bar-h-30 { height: 30%; } .pg-bar-h-35 { height: 35%; }
.pg-bar-h-40 { height: 40%; } .pg-bar-h-45 { height: 45%; } .pg-bar-h-50 { height: 50%; } .pg-bar-h-55 { height: 55%; }
.pg-bar-h-60 { height: 60%; } .pg-bar-h-65 { height: 65%; } .pg-bar-h-70 { height: 70%; } .pg-bar-h-75 { height: 75%; }
.pg-bar-h-80 { height: 80%; } .pg-bar-h-85 { height: 85%; } .pg-bar-h-90 { height: 90%; } .pg-bar-h-95 { height: 95%; }
.pg-bar-h-100 { height: 100%; }

/* ---------- Line chart (SVG, responsive via viewBox) ---------- */
.pg-linechart { width: 100%; position: relative; }
.pg-linechart-svg { width: 100%; height: 220px; display: block; touch-action: pan-y; }
.pg-linechart-labels { display: flex; justify-content: space-between; margin-top: var(--pg-space-2); }
.pg-linechart-labels span { font-size: 0.68rem; color: var(--pg-text-faint); }

.pg-linechart-hit { cursor: pointer; }
.pg-linechart-guide { stroke: var(--pg-border-strong); stroke-width: 1.5; opacity: 0; pointer-events: none; vector-effect: non-scaling-stroke; }
.pg-linechart-guide.is-active { opacity: 1; }

.pg-linechart-tooltip {
  display: none; position: absolute; top: 8px; left: 8px; z-index: 5;
  background: var(--pg-text); color: #fff; border-radius: var(--pg-radius-sm);
  padding: 8px 10px; font-size: 0.74rem; pointer-events: none; white-space: nowrap;
  box-shadow: var(--pg-shadow);
}
.pg-linechart-tooltip.is-open { display: block; }
.pg-linechart-tooltip-label { font-weight: 700; margin-bottom: 4px; opacity: 0.8; font-size: 0.68rem; }
.pg-linechart-tooltip-row { display: flex; align-items: center; gap: 6px; }
.pg-linechart-tooltip-row + .pg-linechart-tooltip-row { margin-top: 3px; }
.pg-linechart-tooltip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--pg-primary); }
.pg-linechart-tooltip-dot.is-primary { background: var(--pg-primary); }
.pg-linechart-tooltip-dot.is-success { background: var(--pg-success); }
.pg-linechart-tooltip-dot.is-warning { background: var(--pg-warning); }
.pg-linechart-tooltip-dot.is-danger { background: var(--pg-danger); }
.pg-linechart-tooltip-dot.is-info { background: var(--pg-info); }
.pg-linechart-tooltip-dot.is-purple { background: var(--pg-purple); }
.pg-chart-legend { display: flex; gap: var(--pg-space-4); flex-wrap: wrap; margin-top: var(--pg-space-3); }
.pg-chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; }
.pg-chart-legend-line { width: 18px; height: 3px; border-radius: 2px; flex-shrink: 0; background: var(--pg-primary); }
.pg-chart-legend-line.is-primary { background: var(--pg-primary); }
.pg-chart-legend-line.is-success { background: var(--pg-success); }
.pg-chart-legend-line.is-warning { background: var(--pg-warning); }
.pg-chart-legend-line.is-danger { background: var(--pg-danger); }
.pg-chart-legend-line.is-info { background: var(--pg-info); }
.pg-chart-legend-line.is-purple { background: var(--pg-purple); }
.pg-chart-legend-line.is-dashed { background: repeating-linear-gradient(to right, currentColor 0 5px, transparent 5px 9px); color: inherit; }
.pg-chart-legend-line.is-dashed.is-primary { color: var(--pg-primary); }
.pg-chart-legend-line.is-dashed.is-success { color: var(--pg-success); }
.pg-chart-legend-line.is-dashed.is-warning { color: var(--pg-warning); }
.pg-chart-legend-line.is-dashed.is-danger { color: var(--pg-danger); }
.pg-chart-legend-line.is-dashed.is-info { color: var(--pg-info); }
.pg-chart-legend-line.is-dashed.is-purple { color: var(--pg-purple); }

/* ---------- Donut chart ---------- */
.pg-logo-preview {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--pg-space-2);
  padding: var(--pg-space-6); border: 1px dashed var(--pg-border); border-radius: var(--pg-radius-md);
  color: var(--pg-primary); text-align: center;
}
.pg-logo-preview .pg-icon { width: 32px; height: 32px; }
.pg-logo-preview strong { font-size: 0.95rem; letter-spacing: 0.03em; }
.pg-logo-preview img { max-width: 100%; max-height: 96px; object-fit: contain; }
.pg-donut-wrap { position: relative; width: max-content; margin: 0 auto; }
.pg-donut-wrap svg { transform: rotate(0deg); display: block; }
.pg-donut-caption {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; pointer-events: none; padding: 0 18%;
}
.pg-donut-caption strong { font-size: 1.2rem; line-height: 1.1; max-width: 100%; overflow-wrap: break-word; }
.pg-donut-caption span { font-size: 0.68rem; color: var(--pg-text-faint); margin-top: 2px; }

/* ---------- Settings ---------- */
.pg-settings-toggle-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--pg-space-3); padding: var(--pg-space-3) 0; border-bottom: 1px solid var(--pg-border); }
.pg-settings-toggle-row:last-child { border-bottom: none; }
.pg-settings-toggle-row .pg-label { margin-bottom: 2px; }
.pg-settings-toggle-row.is-disabled .pg-label,
.pg-settings-toggle-row.is-disabled .pg-hint { color: var(--pg-text-faint); }
.pg-settings-toggle-row.is-disabled .pg-toggle { cursor: not-allowed; }

/* ---------- Two-column field row (forms) ---------- */
.pg-field-row-2 { display: grid; grid-template-columns: 1fr; gap: var(--pg-space-4); }
@media (min-width: 768px) {
  .pg-field-row-2 { grid-template-columns: 1fr 1fr; }
}

.pg-copy-field { display: flex; flex-direction: column; gap: var(--pg-space-2); }
.pg-copy-field .pg-input { background: var(--pg-bg); color: var(--pg-text-muted); }
@media (min-width: 640px) {
  .pg-copy-field { flex-direction: row; }
  .pg-copy-field .pg-btn { flex-shrink: 0; }
}

/* ---------- Tenant portal extras ---------- */
.pg-text-danger { color: var(--pg-danger); }
.pg-text-success { color: var(--pg-success); }
.pg-text-warning { color: var(--pg-warning); }
.pg-text-bold { font-weight: 700; }
.pg-radio-card { display: block; border: 1px solid var(--pg-border-strong); border-radius: var(--pg-radius-sm); padding: var(--pg-space-3); cursor: pointer; }
.pg-radio-card:has(input:checked) { border-color: var(--pg-primary); background: var(--pg-primary-50); }
.pg-radio-card + .pg-radio-card { margin-top: var(--pg-space-3); }
.pg-radio-card .pg-radio-row { justify-content: space-between; }
.pg-radio-card-title { font-weight: 700; font-size: 0.88rem; }
.pg-radio-card-sub { font-size: 0.78rem; color: var(--pg-text-faint); }

/* Quick actions grid (icon + label buttons) */
.pg-quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--pg-space-3); }
.pg-quick-action { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 0.76rem; font-weight: 600; color: var(--pg-text-muted); }
.pg-quick-action-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--pg-primary-50); color: var(--pg-primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pg-quick-action:hover .pg-quick-action-icon { background: var(--pg-primary-gradient); color: #fff; }
.pg-quick-action-button { width: 100%; background: none; border: none; padding: 0; font: inherit; cursor: pointer; }
.pg-quick-action.is-disabled { color: var(--pg-text-faint); cursor: not-allowed; }
.pg-quick-action.is-disabled .pg-quick-action-icon { background: var(--pg-neutral-bg); color: var(--pg-text-faint); }

/* Info card (icon + rows of label/value) */
.pg-info-card-icon { width: 44px; height: 44px; border-radius: var(--pg-radius-sm); background: var(--pg-primary-50); color: var(--pg-primary); display: flex; align-items: center; justify-content: center; margin-bottom: var(--pg-space-3); }
.pg-info-row { display: flex; justify-content: space-between; gap: var(--pg-space-2); padding: 8px 0; border-bottom: 1px solid var(--pg-border); font-size: 0.84rem; }
.pg-info-row:last-child { border-bottom: none; }
.pg-info-row span:first-child { color: var(--pg-text-faint); }
.pg-info-row span:last-child { font-weight: 600; }

/* Help / contact card */
.pg-help-card { background: var(--pg-primary-gradient); color: #fff; border-radius: var(--pg-radius-md); padding: var(--pg-space-5); text-align: center; }
.pg-help-card-icon { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,0.18); display: flex; align-items: center; justify-content: center; margin: 0 auto var(--pg-space-3); }
.pg-help-card p { font-size: 0.82rem; opacity: 0.85; margin-bottom: var(--pg-space-4); }

/* Wide CTA banner (icon + text + button, stacks on mobile) */
.pg-wide-banner {
  background: var(--pg-primary-gradient); color: #fff; border-radius: var(--pg-radius-md);
  padding: var(--pg-space-5); display: flex; flex-direction: column; gap: var(--pg-space-4); align-items: flex-start;
}
.pg-wide-banner-icon { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,0.18); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pg-wide-banner h3 { font-size: 1.05rem; margin-bottom: 4px; }
.pg-wide-banner p { font-size: 0.82rem; opacity: 0.85; }
.pg-wide-banner-body { flex: 1; }
@media (min-width: 768px) {
  .pg-wide-banner { flex-direction: row; align-items: center; }
}

@media (min-width: 640px) {
  .pg-quick-actions { grid-template-columns: repeat(4, 1fr); }
  .pg-quick-actions.is-compact { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .pg-quick-actions { grid-template-columns: repeat(7, 1fr); }
  .pg-quick-actions.is-compact { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Auth ---------- */
.pg-auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--pg-space-4); background: var(--pg-bg); }
.pg-auth-card { width: 100%; max-width: 400px; background: var(--pg-card); border: 1px solid var(--pg-border); border-radius: var(--pg-radius-lg); padding: var(--pg-space-6); box-shadow: var(--pg-shadow); }
.pg-auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: var(--pg-space-5); justify-content: center; }

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .pg-stat-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  .pg-search { display: flex; }
  .pg-search-wrap { display: flex; }
  .pg-user-meta { display: flex; }
  .pg-content { padding: var(--pg-space-6); }
  .pg-topbar { padding: 0 var(--pg-space-6); }
  .pg-page-head { flex-direction: row; align-items: center; justify-content: space-between; }
}

@media (min-width: 1024px) {
  .pg-sidebar { transform: none; position: sticky; height: 100vh; width: var(--pg-sidebar-w); flex-shrink: 0; }
  .pg-sidebar-backdrop { display: none; }
  .pg-shell { display: flex; align-items: flex-start; }
  .pg-main { flex: 1; min-width: 0; padding-bottom: var(--pg-space-6); }
  /* Sidebar defaults to permanently visible here (unlike the mobile overlay below 1024px), so
     the same hamburger toggle flips to collapsing it into an icon-only rail instead of
     showing/hiding an overlay. */
  .pg-shell.is-nav-open .pg-sidebar { width: 76px; }
  .pg-shell.is-nav-open .pg-brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .pg-shell.is-nav-open .pg-nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
  .pg-shell.is-nav-open .pg-brand-text,
  .pg-shell.is-nav-open .pg-nav-item span,
  .pg-shell.is-nav-open .pg-nav-badge,
  .pg-shell.is-nav-open .pg-due-card { display: none; }
  .pg-nav-toggle.pg-desktop-hide { display: none; }
  .pg-tabbar, .pg-fab { display: none; }
  .pg-stat-grid { grid-template-columns: repeat(4, 1fr); }
  .pg-stat-grid.is-5 { grid-template-columns: repeat(5, 1fr); }
  .pg-grid-main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
  .pg-grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pg-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pg-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pg-data-table-cards { display: none; }
  .pg-data-table { display: table; }
  .pg-toolbar-row { flex-wrap: nowrap; }
  .pg-settings-shell { display: grid; grid-template-columns: minmax(220px, 0.85fr) minmax(0, 2fr) minmax(260px, 0.95fr); gap: var(--pg-space-5); align-items: start; }
  .pg-settings-shell.no-side { grid-template-columns: minmax(220px, 0.85fr) minmax(0, 2fr); }
  .pg-settings-other-wrap { grid-column: 1 / -1; }
}

@media (min-width: 1280px) {
  .pg-stat-grid.is-6 { grid-template-columns: repeat(6, 1fr); }
  .pg-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Notification matrix ---------- */
.pg-notify-matrix-wrap { display: none; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 var(--pg-space-5) var(--pg-space-5); }
.pg-notify-matrix { width: 100%; min-width: 560px; border-collapse: collapse; }
.pg-notify-matrix th, .pg-notify-matrix td { padding: 12px 10px; border-bottom: 1px solid var(--pg-border); text-align: center; }
.pg-notify-matrix th { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pg-text-faint); font-weight: 700; }
.pg-notify-matrix th svg { margin: 0 auto; }
.pg-notify-matrix-label { text-align: left; }
.pg-notify-matrix td.pg-notify-matrix-label { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.pg-notify-matrix tr:last-child td { border-bottom: none; }
.pg-checkbox-input { width: 18px; height: 18px; accent-color: var(--pg-primary); cursor: pointer; }

.pg-inline-link { display: inline-flex; align-items: center; gap: 2px; color: var(--pg-primary); font-size: 0.78rem; font-weight: 600; margin-top: 4px; }
.pg-inline-link .pg-icon { width: 14px; height: 14px; }
.pg-inline-link.is-disabled { color: var(--pg-text-faint); cursor: not-allowed; }

.pg-notify-cards { display: flex; flex-direction: column; padding: 0 var(--pg-space-5) var(--pg-space-5); gap: var(--pg-space-4); }
.pg-notify-card { padding-bottom: var(--pg-space-4); border-bottom: 1px solid var(--pg-border); }
.pg-notify-card:last-child { border-bottom: none; padding-bottom: 0; }
.pg-notify-card-head { display: flex; align-items: center; gap: 10px; }
.pg-notify-card-channels { display: flex; flex-wrap: wrap; gap: var(--pg-space-4); margin-top: var(--pg-space-3); margin-left: 42px; }
.pg-notify-card-channel { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--pg-text-muted); }

@media (min-width: 1024px) {
  .pg-notify-cards { display: none; }
  .pg-notify-matrix-wrap { display: block; }
}

/* ---------- Payment settings ---------- */
.pg-toggle-btn-group { display: flex; gap: var(--pg-space-2); background: var(--pg-bg); border-radius: var(--pg-radius-sm); padding: 4px; }
.pg-toggle-btn {
  flex: 1; text-align: center; padding: 10px 12px; border-radius: var(--pg-radius-sm);
  font-size: 0.84rem; font-weight: 700; color: var(--pg-text-muted); cursor: pointer;
}
.pg-toggle-btn { position: relative; }
.pg-toggle-btn input { position: absolute; opacity: 0; pointer-events: none; }
.pg-toggle-btn:has(input:checked) { background: var(--pg-card); color: var(--pg-primary); box-shadow: var(--pg-shadow-sm); }

.pg-alert-danger, .pg-alert-success, .pg-alert-info, .pg-alert-warning {
  display: flex; align-items: flex-start; gap: 10px; padding: var(--pg-space-4);
  border-radius: var(--pg-radius-md); font-size: 0.84rem;
}
.pg-alert-danger .pg-icon, .pg-alert-success .pg-icon, .pg-alert-info .pg-icon, .pg-alert-warning .pg-icon { width: 20px; height: 20px; flex-shrink: 0; }
.pg-alert-danger { background: var(--pg-danger-bg); color: var(--pg-danger); }
.pg-alert-success { background: var(--pg-success-bg); color: var(--pg-success); }
.pg-alert-info { background: var(--pg-info-bg); color: var(--pg-info); }
.pg-alert-warning { background: var(--pg-warning-bg); color: var(--pg-warning); }
.pg-alert-info .pg-hint, .pg-alert-success .pg-hint, .pg-alert-warning .pg-hint { color: inherit; opacity: 0.8; }

.pg-upi-qr-row { display: flex; align-items: center; gap: var(--pg-space-4); flex-wrap: wrap; }
.pg-upi-qr-box {
  width: 96px; height: 96px; border: 1px dashed var(--pg-border); border-radius: var(--pg-radius-md);
  display: flex; align-items: center; justify-content: center; color: var(--pg-text-faint); flex-shrink: 0;
  overflow: hidden;
}
.pg-upi-qr-box img { width: 100%; height: 100%; object-fit: cover; }
.pg-upi-badges { display: flex; flex-wrap: wrap; gap: var(--pg-space-2); }

.pg-settings-group-head { font-size: 0.95rem; margin: var(--pg-space-5) 0 var(--pg-space-3); }
.pg-settings-group-head:first-child { margin-top: 0; }

.pg-lang-list { display: flex; flex-direction: column; gap: var(--pg-space-2); }
.pg-lang-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--pg-border); border-radius: var(--pg-radius-sm); font-size: 0.86rem; }

.pg-icon-btn-outline {
  display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0;
  border: 1px solid var(--pg-border-strong); background: var(--pg-card); border-radius: var(--pg-radius-sm); color: var(--pg-text-muted);
}
.pg-icon-btn-outline:hover { background: var(--pg-bg); }
.pg-icon-btn-outline svg { width: 15px; height: 15px; }

.pg-legend-item:has(.pg-legend-value-wrap) { align-items: flex-start; }
.pg-legend-value-wrap { text-align: right; word-break: break-all; }

/* ---------- Bed configurator ---------- */
.pg-bed-config-head { display: none; }
.pg-bed-row {
  display: grid; grid-template-columns: 1fr; gap: var(--pg-space-3);
  padding: var(--pg-space-4); border: 1px solid var(--pg-border); border-radius: var(--pg-radius-md);
  position: relative; margin-top: var(--pg-space-3);
}
.pg-bed-row-remove { position: absolute; top: var(--pg-space-3); right: var(--pg-space-3); }

@media (min-width: 860px) {
  .pg-bed-config-head {
    display: grid; grid-template-columns: 1.1fr 1.2fr 1fr 0.9fr 40px; gap: var(--pg-space-3);
    padding: 0 var(--pg-space-4); margin-top: var(--pg-space-4);
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pg-text-faint);
  }
  .pg-bed-row { grid-template-columns: 1.1fr 1.2fr 1fr 0.9fr 40px; align-items: center; padding: var(--pg-space-3) var(--pg-space-4); }
  .pg-bed-row-remove { position: static; justify-self: center; }
}

/* ---------- Image dropzone ---------- */
.pg-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  border: 1px dashed var(--pg-border-strong); border-radius: var(--pg-radius-md); padding: var(--pg-space-6) var(--pg-space-4);
  cursor: pointer; color: var(--pg-text-faint);
}
.pg-dropzone.is-dragover { border-color: var(--pg-primary); background: var(--pg-primary-50); }
.pg-dropzone .pg-icon { width: 28px; height: 28px; color: var(--pg-primary); }
.pg-dropzone-title { font-weight: 700; color: var(--pg-text); font-size: 0.88rem; }
.pg-dropzone-sub { font-size: 0.8rem; }
.pg-dropzone-hint { font-size: 0.72rem; }
.pg-dropzone-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.pg-dropzone-previews { display: flex; flex-wrap: wrap; gap: var(--pg-space-3); margin-top: var(--pg-space-4); }
.pg-dropzone-preview { position: relative; width: 84px; height: 84px; border-radius: var(--pg-radius-sm); overflow: hidden; }
.pg-dropzone-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg-dropzone-preview-remove {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(15, 12, 40, 0.65); color: #fff; border: none; display: flex; align-items: center; justify-content: center;
}
.pg-dropzone-preview-remove svg { width: 12px; height: 12px; }
.pg-dropzone-preview.is-marked-removed { opacity: 0.35; }
.pg-dropzone-preview.is-marked-removed::after {
  content: 'Removing'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 12, 40, 0.55); color: #fff; font-size: 0.68rem; font-weight: 700; text-align: center;
}
.pg-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- Building / floor preview ---------- */
.pg-building-preview { border: 1px solid var(--pg-border); border-radius: var(--pg-radius-md); overflow: hidden; }
.pg-building-roof { height: 14px; background: var(--pg-neutral-bg); border-bottom: 2px solid var(--pg-border-strong); clip-path: polygon(0 100%, 50% 0, 100% 100%); }
.pg-building-floor {
  display: flex; align-items: center; justify-content: center; padding: 14px 10px;
  font-size: 0.82rem; font-weight: 600; color: var(--pg-text-muted); border-top: 1px solid var(--pg-border);
}
.pg-building-floor:first-child { border-top: none; }
.pg-building-floor.is-new { background: var(--pg-primary-50); color: var(--pg-primary); border: 2px solid var(--pg-primary); font-weight: 700; }

/* ---------- Three-column field row (forms) ---------- */
.pg-field-row-3 { display: grid; grid-template-columns: 1fr; gap: var(--pg-space-4); }
@media (min-width: 900px) {
  .pg-field-row-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---------- Collapsible form sections (accordion on mobile, flat on desktop) ---------- */
.pg-form-section-head {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: var(--pg-space-5); background: none; border: none; cursor: pointer; text-align: left;
}
.pg-form-section-head h3 { font-size: 1rem; }
.pg-form-section-chevron { width: 18px; height: 18px; color: var(--pg-text-faint); transition: transform 0.15s ease; flex-shrink: 0; }
.pg-form-section.is-open .pg-form-section-chevron { transform: rotate(180deg); }
.pg-form-section-body { display: none; padding-top: 0; }
.pg-form-section.is-open .pg-form-section-body { display: block; }
@media (min-width: 900px) {
  .pg-form-section-head { cursor: default; pointer-events: none; padding-bottom: 0; }
  .pg-form-section-chevron { display: none; }
  .pg-form-section-body { display: block !important; }
}

/* ---------- Avatar / photo upload ---------- */
.pg-avatar-upload { position: relative; display: block; width: 84px; height: 84px; margin: 0 auto var(--pg-space-3); cursor: pointer; }
.pg-avatar-upload-preview {
  width: 84px; height: 84px; border-radius: 50%; background: var(--pg-primary-50); color: var(--pg-primary);
  display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--pg-border);
}
.pg-avatar-upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.pg-avatar-upload-preview .pg-icon { width: 32px; height: 32px; }
.pg-avatar-upload-badge {
  position: absolute; bottom: 0; right: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--pg-primary-gradient); color: #fff; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--pg-card);
}
.pg-avatar-upload-badge .pg-icon { width: 14px; height: 14px; }

/* ---------- Phone number field with fixed country-code prefix ---------- */
.pg-phone-field { position: relative; display: flex; align-items: stretch; }
.pg-phone-prefix {
  display: flex; align-items: center; padding: 0 var(--pg-space-3); border: 1px solid var(--pg-border-strong);
  border-right: none; border-radius: var(--pg-radius-sm) 0 0 var(--pg-radius-sm); background: var(--pg-neutral-bg);
  font-size: 0.86rem; font-weight: 600; color: var(--pg-text-muted); flex-shrink: 0;
}
.pg-phone-field .pg-input { border-radius: 0 var(--pg-radius-sm) var(--pg-radius-sm) 0; }

/* ---------- Password field with show/hide toggle ---------- */
.pg-password-field { position: relative; }
.pg-password-field .pg-input { padding-right: 40px; }
.pg-input-icon-btn {
  position: absolute; top: 50%; right: 10px; transform: translateY(-50%); background: none; border: none;
  color: var(--pg-text-faint); cursor: pointer; display: flex; align-items: center; padding: 4px;
}
.pg-input-icon-btn .pg-icon { width: 18px; height: 18px; }
.pg-input-icon-btn:hover { color: var(--pg-text-muted); }

/* ---------- Document upload tiles ---------- */
.pg-doc-grid { display: grid; grid-template-columns: 1fr; gap: var(--pg-space-3); }
@media (min-width: 640px) {
  .pg-doc-grid { grid-template-columns: 1fr 1fr; }
}
.pg-doc-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  border: 1px dashed var(--pg-border-strong); border-radius: var(--pg-radius-md); padding: var(--pg-space-4);
  cursor: pointer; font-size: 0.82rem;
}
.pg-doc-tile:hover { border-color: var(--pg-primary-light); background: var(--pg-primary-50); }
.pg-doc-tile.is-filled { border-style: solid; border-color: var(--pg-success); background: var(--pg-success-bg); }
.pg-doc-tile-icon { width: 22px; height: 22px; color: var(--pg-primary); }
.pg-doc-tile-label { font-weight: 700; color: var(--pg-text); }
.pg-doc-tile-sub { font-size: 0.72rem; color: var(--pg-text-faint); }
.pg-doc-view-link { grid-column: 1 / -1; text-align: center; margin-top: calc(-1 * var(--pg-space-2)); }

/* ---------- Inline radio row group ---------- */
.pg-radio-row-group { display: flex; flex-wrap: wrap; gap: var(--pg-space-4); }

/* ---------- Number stepper ---------- */
.pg-stepper { display: flex; align-items: stretch; }
.pg-stepper-btn {
  flex-shrink: 0; width: 40px; border: 1px solid var(--pg-border-strong); background: var(--pg-card);
  color: var(--pg-text); font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.pg-stepper-btn:hover { background: var(--pg-primary-50); border-color: var(--pg-primary-light); }
.pg-stepper-btn:first-child { border-radius: var(--pg-radius-sm) 0 0 var(--pg-radius-sm); }
.pg-stepper-btn:last-child { border-radius: 0 var(--pg-radius-sm) var(--pg-radius-sm) 0; }
.pg-stepper-input { border-radius: 0; border-left: none; border-right: none; text-align: center; min-width: 0; }

/* ---------- Section divider ---------- */
.pg-divider { border: none; border-top: 1px solid var(--pg-border); margin: var(--pg-space-4) 0; }

/* ---------- Tenant preview chip (Record Payment) ---------- */
.pg-tenant-preview {
  display: flex; align-items: center; gap: var(--pg-space-3); margin-top: var(--pg-space-3);
  padding: var(--pg-space-3); border-radius: var(--pg-radius-sm); background: var(--pg-primary-50);
}

/* ---------- Payment allocation table ---------- */
.pg-alloc-summary { font-size: 0.84rem; color: var(--pg-text-muted); margin-bottom: var(--pg-space-3); }
.pg-alloc-summary strong { color: var(--pg-text); }
.pg-alloc-table td { vertical-align: middle; }
.pg-alloc-table input.pg-input { padding: 6px 10px; min-width: 90px; }
.pg-alloc-table input[readonly] { background: var(--pg-neutral-bg); color: var(--pg-text-muted); }

/* ---------- Disabled quick-action row ---------- */
.pg-legend-item.is-disabled { display: flex; align-items: center; gap: 8px; color: var(--pg-text-faint); cursor: not-allowed; }
.pg-legend-item-btn { background: none; border: none; padding: 0; font: inherit; color: var(--pg-text); cursor: pointer; display: flex; align-items: center; gap: 8px; }
.pg-legend-item-btn:hover { color: var(--pg-primary); }

/* ---------- Reminder preview card ---------- */
.pg-reminder-preview { padding: var(--pg-space-4); border-radius: var(--pg-radius-md); background: var(--pg-primary-50); }
.pg-reminder-preview .pg-stat-icon { margin-bottom: var(--pg-space-3); }

/* ---------- Scrollable checkbox list (e.g. notice tenant targeting) ---------- */
.pg-checkbox-scroll { max-height: 220px; overflow-y: auto; border: 1px solid var(--pg-border); border-radius: var(--pg-radius-sm); padding: var(--pg-space-3); }

/* ---------- Rich text editor (notice description) ---------- */
.pg-richtext { border: 1px solid var(--pg-border-strong); border-radius: var(--pg-radius-sm); overflow: hidden; }
.pg-richtext-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: var(--pg-space-2); border-bottom: 1px solid var(--pg-border); background: var(--pg-neutral-bg); }
.pg-richtext-btn {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: var(--pg-radius-sm);
  border: 1px solid transparent; background: none; color: var(--pg-text-muted); font-size: 0.85rem; cursor: pointer;
}
.pg-richtext-btn:hover { background: var(--pg-card); border-color: var(--pg-border); color: var(--pg-text); }
.pg-richtext-btn .pg-icon { width: 16px; height: 16px; }
.pg-richtext-underline { text-decoration: underline; }
.pg-richtext-body {
  min-height: 180px; max-height: 360px; overflow-y: auto; padding: var(--pg-space-4);
  font-size: 0.88rem; line-height: 1.6; outline: none;
}
.pg-richtext-body img { max-width: 100%; border-radius: var(--pg-radius-sm); }
.pg-richtext-body:empty::before { content: attr(data-placeholder); color: var(--pg-text-faint); }
.pg-richtext-foot { padding: var(--pg-space-2) var(--pg-space-4); border-top: 1px solid var(--pg-border); font-size: 0.72rem; color: var(--pg-text-faint); }

/* Read-only display of admin-authored rich text (notice bodies etc.) — not the editable version above */
.pg-notice-body { line-height: 1.7; font-size: 0.92rem; }
.pg-notice-body p { margin-bottom: var(--pg-space-3); }
.pg-notice-body ul, .pg-notice-body ol { margin: 0 0 var(--pg-space-3) var(--pg-space-5); }
.pg-notice-body img { max-width: 100%; border-radius: var(--pg-radius-sm); }
.pg-notice-body a { color: var(--pg-primary); text-decoration: underline; }

/* ---------- Priority select (colored by chosen value) ---------- */
.pg-priority-select:has(option[value="high"]:checked) { border-color: var(--pg-danger); color: var(--pg-danger); font-weight: 600; }
.pg-priority-select:has(option[value="medium"]:checked) { border-color: var(--pg-warning); color: var(--pg-warning); font-weight: 600; }
.pg-priority-select:has(option[value="low"]:checked) { border-color: var(--pg-text-faint); }

/* ==================== Updates ==================== */
.pg-changelog-list { display: flex; flex-direction: column; gap: var(--pg-space-2); }
.pg-changelog-item { font-size: 0.84rem; padding-left: var(--pg-space-4); position: relative; color: var(--pg-text-muted); }
.pg-changelog-item::before { content: "\2022"; position: absolute; left: 4px; color: var(--pg-text-faint); }

/* Mobile-first: stacked full-width action buttons; side-by-side only once there's room. */
.pg-btn-row { display: flex; flex-direction: column; gap: var(--pg-space-3); }
.pg-btn-row .pg-btn { width: 100%; }
@media (min-width: 640px) {
  .pg-btn-row { flex-direction: row; }
  .pg-btn-row form { flex: 1; }
}

/* The header's property chip reuses .pg-property-chip (built for the wide sidebar) in a much
   tighter row shared with search/notifications/user menu — cap its width and truncate the name
   instead of letting a long property name push other header items off-screen. */
.pg-header-property-dropdown .pg-property-chip { max-width: 200px; flex-shrink: 0; }
.pg-header-property-dropdown .pg-property-chip > div { min-width: 0; }
.pg-header-property-dropdown .pg-property-chip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The shared .pg-dropdown-menu's 260px min-width overhangs well past the left edge of this
   dropdown's 200px-capped chip trigger, reading as unanchored — tighten it to sit closer. */
.pg-header-property-dropdown .pg-dropdown-menu { min-width: 220px; }
