/* ==========================================================================
   Royal LePage — Client Closing Portal
   Design tokens and component styles follow royallepage.ca:
   Roboto (body) + Raleway (display), brand red #ea002a, ink #231f20,
   1px #ccc card borders, 8px card radius, 4px buttons, white surfaces
   over a light grey page.
   ========================================================================== */

:root {
  --rlp-red: #ea002a;
  --rlp-red-dark: #a20025;
  --rlp-red-soft: #fdecef;
  --rlp-ink: #231f20;
  --rlp-black: #000000;
  --rlp-grey-050: #fbfbfb;
  --rlp-grey-100: #f5f5f5;
  --rlp-grey-200: #eeeeee;
  --rlp-grey-300: #d8d8d8;
  --rlp-border: #cccccc;
  --rlp-muted: #6b6b6b;
  --rlp-cyan: #00afd8;
  --rlp-cyan-soft: #e3f5f9;
  --rlp-cyan-ink: #00718c;
  --rlp-green: #008a00;
  --rlp-green-soft: #e9f5e9;
  --rlp-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
  --rlp-shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.28);
  --font-body: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: Raleway, Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --radius-card: 8px;
  --radius-control: 4px;
  --header-h: 74px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--rlp-ink);
  background: var(--rlp-grey-100);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--rlp-red); text-decoration: none; }
a:hover { color: var(--rlp-red-dark); text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--rlp-ink);
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.9rem, 3vw, 2.5rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

::selection { background: var(--rlp-red); color: #fff; }

:focus-visible {
  outline: 3px solid rgba(234, 0, 42, 0.45);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  background: var(--rlp-ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-control);
  font-size: 0.9rem;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; color: #fff; text-decoration: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--rlp-grey-200);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  max-width: 1320px;
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 10px 28px;
  display: flex;
  align-items: center;
  gap: 36px;
}

.brand-lockup {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 0 0 auto;
}
.brand-lockup:hover { text-decoration: none; }
.brand-logo { height: 34px; width: auto; }
.brand-wordmark { height: 19px; width: auto; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.site-nav a { color: var(--rlp-ink); }
.site-nav a:hover { color: var(--rlp-red); text-decoration: none; }

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--rlp-muted);
}
.header-right strong { color: var(--rlp-ink); font-weight: 500; }

.header-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 3px;
  background: var(--rlp-red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (max-width: 1080px) {
  .site-nav { display: none; }
}
@media (max-width: 640px) {
  .header-inner { padding: 10px 18px; gap: 14px; min-height: 64px; }
  .brand-logo { height: 28px; }
  .brand-wordmark { height: 16px; }
  .header-right span.user-chip { display: none; }
  .header-right { gap: 10px; }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--rlp-red);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 11px 20px;
  min-height: 40px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  text-decoration: none;
}
.btn:hover { background: var(--rlp-red-dark); color: #fff; text-decoration: none; }
.btn:active { background: var(--rlp-red); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: #fff;
  color: var(--rlp-ink);
  border-color: var(--rlp-border);
}
.btn-secondary:hover { background: #fff; border-color: var(--rlp-ink); color: var(--rlp-ink); }

.btn-ghost { background: transparent; color: var(--rlp-red); border-color: transparent; padding-left: 8px; padding-right: 8px; }
.btn-ghost:hover { background: var(--rlp-red-soft); color: var(--rlp-red-dark); }

.btn-danger-ghost { background: #fff; color: var(--rlp-red); border-color: var(--rlp-border); }
.btn-danger-ghost:hover { border-color: var(--rlp-red); background: var(--rlp-red-soft); color: var(--rlp-red-dark); }

.btn-sm { min-height: 34px; padding: 7px 13px; font-size: 0.8rem; }
.btn-block { width: 100%; }

.btn .arrow { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field { margin-bottom: 17px; }
.field:last-of-type { margin-bottom: 0; }

label,
.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.73rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #5a5a5a;
}

input,
select,
textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.93rem;
  font-weight: 400;
  color: var(--rlp-ink);
  background: #fff;
  border: 1px solid var(--rlp-border);
  border-radius: 2px;
  padding: 11px 13px;
  min-height: 42px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23231f20' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}
input:hover, select:hover, textarea:hover { border-color: #a6a6a6; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--rlp-red);
  box-shadow: 0 0 0 3px rgba(234, 0, 42, 0.12);
}
input::placeholder, textarea::placeholder { color: #9a9a9a; }
input[type="date"] { min-height: 42px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
}
.form-grid .field-full { grid-column: 1 / -1; }
.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}
.hint { font-size: 0.78rem; color: var(--rlp-muted); margin-top: 6px; }

.error-msg {
  display: none;
  background: var(--rlp-red-soft);
  color: var(--rlp-red-dark);
  border-left: 3px solid var(--rlp-red);
  padding: 10px 12px;
  border-radius: 2px;
  font-size: 0.85rem;
  margin: 0 0 16px;
}
.error-msg.is-visible { display: block; }

/* --------------------------------------------------------------------------
   Login / landing
   -------------------------------------------------------------------------- */

.login-page { background: var(--rlp-ink); }

.login-hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--rlp-ink) url("/img/hero-login.webp") center / cover no-repeat;
  isolation: isolate;
}
.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(10, 10, 10, 0.88) 0%, rgba(10, 10, 10, 0.62) 48%, rgba(10, 10, 10, 0.32) 100%),
    linear-gradient(0deg, rgba(10, 10, 10, 0.72) 0%, rgba(10, 10, 10, 0.08) 55%);
}

.login-header {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand-lockup--reverse .brand-logo { height: 40px; }
.brand-lockup--reverse .brand-wordmark { height: 22px; }

.login-home-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  padding-bottom: 3px;
}
.login-home-link:hover { color: #fff; text-decoration: none; border-color: #fff; }

.login-main {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 40px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 412px);
  gap: 68px;
  align-items: center;
}

.login-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 22px;
}
.login-kicker::before {
  content: "";
  width: 34px;
  height: 3px;
  background: var(--rlp-red);
}

.login-copy h1 {
  color: #fff;
  font-size: clamp(2.6rem, 4.6vw, 4.2rem);
  line-height: 1.03;
  margin: 0 0 22px;
  max-width: 11ch;
}

.login-copy .lede {
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.04rem;
  font-weight: 300;
  line-height: 1.65;
  max-width: 47ch;
  margin: 0 0 30px;
}

.login-points {
  list-style: none;
  margin: 0;
  padding: 26px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  flex-wrap: wrap;
  gap: 16px 38px;
  max-width: 560px;
}
.login-points li {
  position: relative;
  padding-left: 18px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.86rem;
}
.login-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  background: var(--rlp-red);
  transform: rotate(45deg);
}
.login-points strong { display: block; color: #fff; font-weight: 500; margin-bottom: 2px; }

.login-card {
  background: #fff;
  border-radius: var(--radius-card);
  border-top: 4px solid var(--rlp-red);
  box-shadow: var(--rlp-shadow-lg);
  padding: 32px 32px 28px;
  color: var(--rlp-ink);
}
.login-card-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--rlp-grey-200);
}
.login-card-brand .brand-logo { height: 30px; }
.login-card-brand .brand-wordmark { height: 17px; }
.login-card h2 { font-size: 1.55rem; margin: 0 0 6px; }
.login-card-sub { color: var(--rlp-muted); font-size: 0.88rem; margin: 0 0 22px; }
.login-help { margin: 18px 0 0; font-size: 0.78rem; color: var(--rlp-muted); text-align: center; }

.login-footer {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px 40px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.74rem;
}
.login-footer a { color: rgba(255, 255, 255, 0.82); }
.login-footer a:hover { color: #fff; }
.login-footer-links { display: flex; gap: 18px; }

@media (max-width: 1024px) {
  .login-main { grid-template-columns: minmax(0, 1fr) minmax(330px, 390px); gap: 40px; padding: 24px 32px 52px; }
  .login-header { padding: 22px 32px; }
  .login-copy h1 { font-size: clamp(2.4rem, 5vw, 3.2rem); }
}

@media (max-width: 820px) {
  .login-hero::before {
    background:
      linear-gradient(180deg, rgba(10, 10, 10, 0.45) 0%, rgba(10, 10, 10, 0.76) 46%, rgba(10, 10, 10, 0.9) 100%);
  }
  .login-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
    padding: 26px 24px 46px;
    align-content: start;
  }
  .login-copy h1 { max-width: 14ch; }
  .login-points { gap: 14px 26px; padding-top: 20px; }
  .login-card { width: 100%; max-width: 460px; }
  .login-header { padding: 20px 24px; }
  .login-footer { padding: 16px 24px 24px; }
}

@media (max-width: 520px) {
  .login-header { padding: 16px 18px; }
  .brand-lockup--reverse .brand-logo { height: 32px; }
  .brand-lockup--reverse .brand-wordmark { height: 18px; }
  .login-home-link { font-size: 0.68rem; }
  .login-main { padding: 18px 18px 38px; gap: 28px; }
  .login-copy h1 { font-size: 2.35rem; }
  .login-copy .lede { font-size: 0.96rem; }
  .login-points { flex-direction: column; gap: 12px; }
  .login-card { padding: 26px 22px 24px; }
  .login-footer { padding: 14px 18px 22px; font-size: 0.68rem; }
}

/* --------------------------------------------------------------------------
   App shell / page furniture
   -------------------------------------------------------------------------- */

.app-page { min-height: 100vh; display: flex; flex-direction: column; }
.app-page main { flex: 1; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 24px 64px;
}
.container-wide { max-width: 1320px; }

.eyebrow {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--rlp-red);
  margin-bottom: 8px;
}
.eyebrow--muted { color: var(--rlp-muted); }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head p { color: var(--rlp-muted); font-size: 0.9rem; margin: 6px 0 0; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.panel {
  background: #fff;
  border: 1px solid var(--rlp-border);
  border-radius: var(--radius-card);
  box-shadow: var(--rlp-shadow);
  overflow: hidden;
}
.panel + .panel { margin-top: 20px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--rlp-grey-200);
  background: #fff;
}
.panel-head h2 { font-size: 1.18rem; }
.panel-head h3 { font-size: 1rem; }
.panel-head p { color: var(--rlp-muted); font-size: 0.8rem; margin: 4px 0 0; }
.panel-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-body { padding: 20px 22px; }
.panel-form { padding: 20px 22px; border-bottom: 1px solid var(--rlp-grey-200); background: var(--rlp-grey-050); }
.panel-form[hidden] { display: none; }
.panel-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--rlp-grey-200);
  background: var(--rlp-grey-050);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.muted { color: var(--rlp-muted); }
.small { font-size: 0.8rem; }

.site-footer {
  border-top: 1px solid var(--rlp-grey-200);
  background: #fff;
  padding: 22px 24px;
  color: var(--rlp-muted);
  font-size: 0.76rem;
}
.site-footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer .brand-logo { height: 22px; }
.site-footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

.loading, .empty-state {
  padding: 44px 24px;
  text-align: center;
  color: var(--rlp-muted);
  font-size: 0.92rem;
}
.empty-state h3 { margin: 0 0 8px; color: var(--rlp-ink); }
.empty-state p { max-width: 42ch; margin: 0 auto; }

/* --------------------------------------------------------------------------
   Status badges
   -------------------------------------------------------------------------- */

.badge, .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-due { background: var(--rlp-red-soft); color: var(--rlp-red-dark); }
.badge-paid { background: var(--rlp-green-soft); color: var(--rlp-green); }
.badge-not_needed { background: var(--rlp-grey-200); color: #5a5a5a; }

.status-in_progress { background: var(--rlp-cyan-soft); color: var(--rlp-cyan-ink); }
.status-closed { background: var(--rlp-green-soft); color: var(--rlp-green); }
.status-cancelled { background: var(--rlp-grey-200); color: #5a5a5a; }

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap { width: 100%; overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  text-align: left;
  padding: 11px 22px;
  background: var(--rlp-grey-050);
  border-bottom: 1px solid var(--rlp-grey-200);
  color: var(--rlp-muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table td {
  padding: 15px 22px;
  border-bottom: 1px solid var(--rlp-grey-200);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--rlp-grey-050); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .actions-col { width: 1%; white-space: nowrap; text-align: right; }

.fee-name { font-weight: 500; color: var(--rlp-ink); }
.fee-desc { color: var(--rlp-muted); font-size: 0.78rem; margin-top: 2px; }
.fee-amount { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fee-amount.is-muted { color: var(--rlp-muted); font-weight: 400; }

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */

.property-hero {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  min-height: 232px;
  display: flex;
  align-items: flex-end;
  padding: 28px 30px;
  color: #fff;
  background: var(--rlp-ink) url("/img/hero-property.webp") center / cover no-repeat;
  isolation: isolate;
  margin-bottom: 20px;
}
.property-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(10, 10, 10, 0.82) 0%, rgba(10, 10, 10, 0.5) 55%, rgba(10, 10, 10, 0.18) 100%);
}
.property-hero h2 {
  color: #fff;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  margin: 12px 0 12px;
  max-width: 26ch;
}
.property-hero .status-pill { background: #fff; color: var(--rlp-cyan-ink); }
.property-hero .status-pill.status-closed { background: #fff; color: var(--rlp-green); }
.property-hero .status-pill.status-cancelled { background: #fff; color: #5a5a5a; }

.property-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 30px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  max-width: 760px;
}
.property-meta span { display: block; }
.property-meta .meta-label {
  display: block;
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 3px;
}
.property-meta strong { font-weight: 500; font-size: 0.95rem; color: #fff; }

.property-photos {
  margin: 20px 0;
  padding: 22px 24px;
  background: #fff;
  border: 1px solid var(--rlp-border);
  border-radius: var(--radius-card);
  box-shadow: var(--rlp-shadow);
}
.property-photos h2,
.property-photos h3 { margin: 0; }
.property-photos .detail-section-head { margin-bottom: 14px; }
.photo-upload-form {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}
.photo-upload-form .field { flex: 1; }
.property-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 16px;
}
.property-photo-card {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--rlp-grey-200);
  border-radius: var(--radius-control);
  background: var(--rlp-grey-050);
}
.property-photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.property-photo-grid--admin .property-photo-card .btn {
  margin: 8px;
}
.property-photo-grid > .empty-state {
  grid-column: 1 / -1;
  padding: 16px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat-card {
  background: #fff;
  border: 1px solid var(--rlp-border);
  border-radius: var(--radius-card);
  box-shadow: var(--rlp-shadow);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--rlp-red);
  opacity: 0.9;
}
.stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--rlp-muted);
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.2vw, 1.8rem);
  font-weight: 500;
  line-height: 1.1;
  color: var(--rlp-ink);
  font-variant-numeric: tabular-nums;
}
.stat-value.is-due { color: var(--rlp-red); }
.stat-value.is-paid { color: var(--rlp-green); }
.stat-foot { margin-top: 8px; font-size: 0.75rem; color: var(--rlp-muted); }

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--rlp-grey-200);
  overflow: hidden;
  margin-top: 12px;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--rlp-green);
  border-radius: inherit;
  transition: width 0.4s ease;
}

.fees-panel .panel-head { background: #fff; }
.fees-total { text-align: right; }
.fees-total .stat-label { margin-bottom: 2px; }
.fees-total strong { font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; }

.statement-note {
  margin-top: 16px;
  color: var(--rlp-muted);
  font-size: 0.76rem;
  line-height: 1.6;
  max-width: 90ch;
}

.select-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--rlp-muted); }
.select-inline label { margin: 0; white-space: nowrap; }
.select-inline select { width: auto; min-width: 220px; min-height: 36px; padding: 7px 36px 7px 11px; font-size: 0.85rem; }

.error-state { text-align: center; padding: 64px 24px; }
.error-state h2 { margin-bottom: 10px; }
.error-state p { color: var(--rlp-muted); margin-bottom: 20px; }

@media (max-width: 860px) {
  .stat-grid, .stat-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .property-hero { min-height: 210px; padding: 22px 22px; }
}
@media (max-width: 620px) {
  .container { padding: 20px 16px 52px; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .select-inline { width: 100%; align-items: stretch; flex-direction: column; gap: 6px; }
  .select-inline select { width: 100%; }
  .stat-grid, .stat-grid--4 { grid-template-columns: minmax(0, 1fr); }
  .stat-card { padding: 16px 18px; }
  .property-hero { min-height: 220px; padding: 18px; }
  .property-hero h2 { margin-top: 10px; }
  .property-meta { gap: 10px 20px; }
  .property-meta strong { font-size: 0.88rem; }
  .fees-panel .panel-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .fees-total { text-align: left; }
}

/* Stacked table rows on small screens, using data-label attributes. */
@media (max-width: 700px) {
  .data-table.responsive thead { display: none; }
  .data-table.responsive,
  .data-table.responsive tbody,
  .data-table.responsive tr,
  .data-table.responsive td { display: block; width: 100%; }
  .data-table.responsive tr {
    padding: 14px 18px;
    border-bottom: 1px solid var(--rlp-grey-200);
  }
  .data-table.responsive tbody tr:last-child { border-bottom: 0; }
  .data-table.responsive tbody tr:hover { background: transparent; }
  .data-table.responsive td {
    padding: 5px 0;
    border: 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
  }
  .data-table.responsive td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--rlp-muted);
  }
  .data-table.responsive td.num { text-align: right; }
  .data-table.responsive td.fee-cell { display: block; padding-bottom: 10px; }
  .data-table.responsive td.fee-cell::before { display: none; }
  .data-table.responsive .actions-col { text-align: left; }
}

/* --------------------------------------------------------------------------
   Admin
   -------------------------------------------------------------------------- */

.admin-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}

.list { padding: 6px 0; }
.list-row {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--rlp-grey-200);
  padding: 13px 19px;
  font-family: var(--font-body);
  color: var(--rlp-ink);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--rlp-grey-050); }
.list-row.is-selected { background: #fff7f8; border-left-color: var(--rlp-red); }

.avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--rlp-grey-200);
  color: var(--rlp-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.list-row.is-selected .avatar { background: var(--rlp-red); color: #fff; }

.row-main { flex: 1; min-width: 0; }
.row-main strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-main span {
  display: block;
  font-size: 0.76rem;
  color: var(--rlp-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-meta { flex: 0 0 auto; font-size: 0.72rem; color: var(--rlp-muted); }
.row-right { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.row-right .amount { font-size: 0.76rem; color: var(--rlp-muted); font-variant-numeric: tabular-nums; }

.property-row { align-items: flex-start; }
.property-row .row-main { padding-top: 2px; }
.property-row .row-main strong { white-space: normal; overflow: visible; line-height: 1.35; }

.detail-panel { margin-top: 20px; scroll-margin-top: 90px; }
.detail-panel:not([hidden]) { animation: fade-up 0.18s ease; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--rlp-grey-200);
  border-top: 4px solid var(--rlp-red);
  flex-wrap: wrap;
}
.detail-head h2 { margin: 0 0 6px; font-size: 1.45rem; }
.detail-head p { color: var(--rlp-muted); font-size: 0.84rem; margin: 0; }
.detail-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-actions select { width: auto; min-height: 34px; padding: 6px 34px 6px 10px; font-size: 0.8rem; }

.detail-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 24px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--rlp-grey-200);
  background: var(--rlp-grey-050);
}
.detail-meta span {
  display: block;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rlp-muted);
  margin-bottom: 3px;
}
.detail-meta strong { font-weight: 500; font-size: 0.88rem; }

.detail-section { padding: 20px 24px 4px; }
.detail-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.detail-section-head h3 { font-size: 1.12rem; }
.detail-totals { display: flex; gap: 22px; font-size: 0.8rem; color: var(--rlp-muted); }
.detail-totals strong { display: block; font-size: 1.02rem; font-weight: 500; color: var(--rlp-ink); font-variant-numeric: tabular-nums; }
.detail-totals .is-due strong { color: var(--rlp-red); }
.detail-totals .is-paid strong { color: var(--rlp-green); }

.fee-edit-table td { padding: 9px 10px; }
.fee-edit-table th { padding: 10px; }
.fee-edit-table input,
.fee-edit-table select {
  min-height: 36px;
  padding: 7px 9px;
  font-size: 0.82rem;
}
.fee-edit-table select { padding-right: 30px; }
.fee-edit-table input[type="number"] { min-width: 100px; }
.fee-edit-table .cell-name { min-width: 150px; }
.fee-edit-table .cell-desc { min-width: 170px; }
.fee-edit-table .btn { white-space: nowrap; }

.add-fee {
  padding: 18px 24px 22px;
  border-top: 1px solid var(--rlp-grey-200);
  background: var(--rlp-grey-050);
}
.add-fee h4 { font-family: var(--font-display); font-size: 0.98rem; font-weight: 500; margin: 0 0 14px; }
.add-fee .form-grid { align-items: end; }
.add-fee .form-actions { margin-top: 0; }

.section-gap { margin-top: 20px; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  max-width: min(420px, calc(100vw - 32px));
  background: var(--rlp-ink);
  color: #fff;
  border-left: 4px solid var(--rlp-green);
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
  padding: 13px 18px;
  font-size: 0.84rem;
  line-height: 1.4;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { border-left-color: var(--rlp-red); }

@media (max-width: 1080px) {
  .admin-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-head { flex-direction: column; }
  .detail-actions { width: 100%; }
  .detail-actions select { flex: 1; }
  .fee-edit-table { min-width: 720px; }
  .fee-edit-table td,
  .fee-edit-table th { padding: 8px; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .panel-head { padding: 15px 17px; flex-wrap: wrap; }
  .panel-form { padding: 16px 17px; }
  .list-row { padding: 12px 15px; }
  .detail-head { padding: 18px 17px; }
  .detail-meta { padding: 16px 17px; gap: 12px 16px; }
  .detail-section { padding: 16px 17px 2px; }
  .property-photos { padding: 17px; }
  .photo-upload-form { align-items: stretch; flex-direction: column; }
  .photo-upload-form .btn { width: 100%; }
  .add-fee { padding: 16px 17px 18px; }
  .panel-foot { padding: 12px 17px; }
  .row-meta { display: none; }
  .toast { right: 16px; bottom: 16px; left: 16px; max-width: none; }
  .site-footer-inner { flex-direction: column; align-items: flex-start; }
  .detail-totals { gap: 16px; }
  .admin-grid .panel-head-actions { width: 100%; }
  .admin-grid .panel-head-actions .btn { flex: 1; }
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  body { background: #fff; }
  .site-header, .site-footer, .page-actions, .skip-link,
  .statement-note .no-print { display: none !important; }
  .container { max-width: none; padding: 0; }
  .property-hero {
    min-height: 0;
    padding: 20px 24px;
    background: #fff !important;
    color: var(--rlp-ink);
    border: 1px solid #ccc;
    border-radius: 0;
  }
  .property-hero::before { display: none; }
  .property-hero h2 { color: var(--rlp-ink); margin: 8px 0; }
  .property-meta { border-top-color: #ccc; }
  .property-meta .meta-label { color: var(--rlp-muted); }
  .property-meta strong { color: var(--rlp-ink); }
  .property-hero .status-pill { border: 1px solid currentColor; }
  .stat-card, .panel { box-shadow: none; break-inside: avoid; }
  .data-table tbody tr:hover { background: transparent; }
  a { color: inherit; }
}
