/* Indigo Real Estate Management - resident reports
   Primary colour: deep indigo #3d3a8f. Mobile-first.

   Type system shared with the resident app: Fraunces for display moments,
   Hanken Grotesk for the interface. Self-hosted rather than pulled from a CDN,
   so an installed app still renders correctly with no network. */

@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/fraunces.woff2") format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/static/fonts/hanken.woff2") format("woff2");
  font-weight: 400 800; font-style: normal; font-display: swap;
}

:root {
  --brass: #8a6a1f;
  --brass-line: #c8a556;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  --indigo: #3d3a8f;
  --indigo-dark: #2c2a6b;
  --indigo-light: #ecebf7;
  --indigo-tint: #f6f6fc;
  --accent: #7938b3;        /* Indigo logo purple - used as an accent */
  --ink: #1f2033;
  --muted: #5f6076;
  --line: #e0e0ea;
  --white: #ffffff;
  --danger: #b4232a;
  --danger-bg: #fdecec;
  --warn: #8a5a00;
  --warn-bg: #fdf3e0;
  --ok: #1d6a3a;
  --ok-bg: #e8f6ec;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(31, 32, 51, 0.12);
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden;               /* iOS: html can scroll even if body can't */
  overscroll-behavior-x: none;      /* no sideways rubber-band of the whole page */
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--indigo-tint);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;               /* never scroll sideways on mobile */
  overscroll-behavior-x: none;
  -webkit-text-size-adjust: 100%;   /* stop iOS auto-inflating text */
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; }
main { flex: 1 0 auto; min-width: 0; }   /* flex item must be allowed to shrink to the viewport */

/* Per-development background: a soft, fixed photo behind the resident app. */
body.has-dev-bg {
  background: var(--indigo-tint);
}
body.has-dev-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--dev-bg);
  background-size: cover;
  background-position: center;
  opacity: 0.14;
  pointer-events: none;
}

/* Built-in gradient themes (used when a development has no uploaded photo).
   Applied to the whole page as a gentle, always-legible wash. */
body.bg-theme { background-attachment: fixed; }
body.bg-theme-indigo    { background: linear-gradient(160deg, #eef0fb 0%, #dfe3f5 100%); }
body.bg-theme-sage      { background: linear-gradient(160deg, #eef4ee 0%, #dde9df 100%); }
body.bg-theme-slate     { background: linear-gradient(160deg, #eef1f4 0%, #dfe5ea 100%); }
body.bg-theme-champagne { background: linear-gradient(160deg, #f7f2ea 0%, #ede2d0 100%); }
body.bg-theme-coastal   { background: linear-gradient(160deg, #ecf3f6 0%, #d8e7ee 100%); }

/* Theme picker on the staff Branding page. */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6rem;
  margin-top: 0.4rem;
}
.theme-opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border, #d9d8ee);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
}
.theme-opt:has(input:checked) {
  border-color: var(--indigo, #3d3a8f);
  box-shadow: 0 0 0 2px rgba(61, 58, 143, 0.18);
}
.theme-opt input { margin: 0; }
.theme-swatch {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex: 0 0 auto;
}
.theme-name { font-size: 0.88rem; }

/* Floating bottom tab bar for the resident app (phone-first, works on desktop).
   Only shown when a resident is signed in (body.resident-view). */
.rtabs { display: none; }
body.resident-view .rtabs,
body.m-view .rtabs {
  display: flex;
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  justify-content: space-around;
  gap: 2px;
  padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border, #e2e1f0);
  box-shadow: 0 -6px 24px -12px rgba(30, 28, 80, 0.35);
  z-index: 50;
}
@media (min-width: 600px) {
  body.resident-view .rtabs,
  body.m-view .rtabs {
    bottom: 16px;
    border: 1px solid var(--border, #e2e1f0);
    border-radius: 20px;
    box-shadow: 0 18px 40px -16px rgba(30, 28, 80, 0.45);
  }
}
.rtab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  text-decoration: none;
  color: var(--muted, #6b6a8a);
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 12px;
}
.rtab svg {
  width: 24px; height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rtab.active { color: var(--indigo, #3d3a8f); }
.rtab:focus-visible { outline: 2px solid var(--indigo, #3d3a8f); outline-offset: 2px; }
.rtab-icon { position: relative; display: inline-flex; }
.rtab-dot {
  position: absolute; top: -2px; right: -4px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #e5484d; border: 2px solid #fff;
}

/* Keep content and footer clear of the fixed tab bar. */
body.resident-view main,
body.m-view main { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
body.resident-view .sitefoot,
body.m-view .sitefoot { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

/* Preview mode banner (staff previewing a development's resident view). */
.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 60;
  background: #1b1836;
  color: #fff;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
}
.preview-bar .btn { flex: 0 0 auto; }

/* Slim branded header strip at the top of inner resident screens. */
.screen-head {
  background: linear-gradient(150deg, #12b3a8 0%, #2a2a72 88%);
  color: #fff;
  border-radius: 18px;
  padding: 0.85rem 1.15rem;
  margin: 0.75rem 0 1.1rem;
  box-shadow: 0 16px 34px -22px rgba(20, 20, 60, 0.5);
}
.screen-head h1 { margin: 0; font-size: 1.4rem; line-height: 1.15; }

/* Compact footer for the resident / public interface. */
.sitefoot-min { font-size: 0.72rem; }
.sitefoot-min .foot-min { display: flex; flex-direction: column; gap: 0.15rem; }
.sitefoot-min .foot-min strong { font-size: 0.8rem; }

/* ---- Resident front page (home) --------------------------------------- */
.rhome-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.rhome .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--indigo, #3d3a8f);
  opacity: 0.85;
}
.rhome-title {
  font-size: 2rem;
  line-height: 1.08;
  margin: 0.2rem 0 0;
  padding-left: 0.7rem;
  border-left: 4px solid #d8b877;
}
.rhome-bell {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border, #e2e1f0);
  background: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 12px -6px rgba(30, 28, 80, 0.35);
  /* Centre the contents. Sized originally for an emoji, so an SVG child sat on
     the text baseline rather than in the middle of the circle. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  color: var(--indigo);
  text-decoration: none;
}
.rhome-bell svg { display: block; }

/* Swipeable action pills on the resident home. A CSS grid carousel: each column
   is exactly the container width, so it can never force the page wider than the
   screen (unlike flex items with min-width, which can on mobile Safari). */
.pill-pager {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;   /* swiping pills must NOT drag the page */
  scrollbar-width: none;
  margin-top: 1.1rem;
  padding-bottom: 4px;
  max-width: 100%;
}
.pill-pager::-webkit-scrollbar { display: none; }
.pill {
  position: relative;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  min-width: 0;
  min-height: 164px;
  border-radius: 22px;
  color: #fff;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 1.4rem;
  box-shadow: 0 22px 44px -22px rgba(20, 20, 60, 0.55);
}
.pill svg {
  width: 42px; height: 42px;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.pill-title { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.01em; }
.pill-report   { background: linear-gradient(150deg, #12b3a8 0%, #2a2a72 90%); }
.pill-messages { background: linear-gradient(150deg, #6d5be0 0%, #2a2a72 90%); }
.pill-account  { background: linear-gradient(150deg, #2f7bf0 0%, #17b0a6 92%); }
.pill-badge {
  position: absolute; top: 14px; right: 16px;
  background: #e5484d; color: #fff;
  font-weight: 800; font-size: 0.8rem;
  border-radius: 999px; padding: 2px 10px;
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.5);
}
.pill-dots { display: flex; justify-content: center; gap: 7px; margin: 0.85rem 0 0.2rem; }
.pill-dots .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(60, 58, 143, 0.28); transition: all 0.2s ease;
}
.pill-dots .dot.active { background: var(--indigo, #3d3a8f); width: 20px; border-radius: 999px; }

.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  margin-top: 1.1rem;
  min-height: 210px;
  color: #fff;
  background: linear-gradient(150deg, #12b3a8 0%, #2a2a72 88%);
  box-shadow: 0 22px 44px -22px rgba(20, 20, 60, 0.55);
}
.hero-card.has-photo {
  background-image:
    linear-gradient(150deg, rgba(10, 60, 90, 0.45) 0%, rgba(20, 18, 54, 0.86) 92%),
    var(--hero-bg);
  background-size: cover;
  background-position: center;
}
.hero-skyline {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 100%; height: 58%;
}
.hero-inner {
  position: relative;
  z-index: 1;
  padding: 1.3rem 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  min-height: 210px;
}
.hero-brand {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  opacity: 0.92;
}
.hero-name {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0.55rem 0 0.35rem;
}
.hero-sub {
  font-size: 0.9rem;
  line-height: 1.4;
  opacity: 0.9;
  max-width: 30ch;
  margin-bottom: 1.1rem;
}
.hero-cta {
  align-self: flex-start;
  margin-top: auto;
  background: #fff;
  color: #1b1836;
  font-weight: 700;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.5);
}
.hero-cta:hover { background: #f3f1ff; }

.rhome-h2 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.7rem;
}
.rhome-alert {
  display: block;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: #eef0fb;
  border: 1px solid #d7dbf3;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
}

.rlist { display: flex; flex-direction: column; gap: 0.6rem; }

.anncard {
  background: #fff;
  border: 1px solid var(--border, #ecebf5);
  border-left: 4px solid var(--indigo, #3d3a8f);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  box-shadow: 0 10px 24px -18px rgba(30, 28, 80, 0.4);
}
.anncard-title { font-weight: 700; }
.anncard-body { margin-top: 0.4rem; white-space: pre-line; }

.rcard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid var(--border, #ecebf5);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  box-shadow: 0 10px 24px -18px rgba(30, 28, 80, 0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.rcard:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px -18px rgba(30, 28, 80, 0.5);
}
.rcard-main { flex: 1; min-width: 0; }   /* allow long text to wrap instead of pushing the badge off */
.rcard-ref { font-weight: 800; color: var(--indigo, #3d3a8f); font-size: 1.02rem; }
.rcard-meta { font-size: 0.9rem; margin-top: 0.12rem; overflow-wrap: anywhere; }
.rcard-date { color: var(--muted, #6b6a8a); font-size: 0.78rem; margin-top: 0.15rem; }
.rcard .badge { flex-shrink: 0; }

/* Property switcher (residents with more than one property). */
.prop-switch { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.9rem; }
.prop-switch-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em;
  font-weight: 700; color: var(--muted, #6b6a8a); flex: 0 0 auto;
}
.prop-switch select { flex: 1; min-width: 0; }
.prop-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.prop-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.7rem 0.85rem; border: 1px solid var(--border, #ecebf5); border-radius: 12px;
}
.prop-item form { margin: 0; }

/* A read-only value shown where a field is fixed (e.g. locked development). */
.locked-field {
  padding: 0.6rem 0.75rem;
  background: var(--indigo-tint);
  border: 1px solid var(--border, #d9d8ee);
  border-radius: 8px;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

a { color: var(--indigo); }

/* ---------- Top bar (staff) ---------- */
.topbar {
  background: var(--indigo);
  color: var(--white);
  padding-top: env(safe-area-inset-top, 0px);   /* clear the notch when installed */
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.6rem max(1rem, env(safe-area-inset-right)) 0.6rem max(1rem, env(safe-area-inset-left));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}
.brand {
  color: var(--white);
  font-weight: 700;
  text-decoration: none;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
/* The mark's badge is dark navy, which would sit muddily on the indigo bar,
   so it gets a light chip — reads cleanly and looks like the app icon. */
.brand-logo {
  height: 30px; width: auto; display: block;
  background: #fff; border-radius: 8px; padding: 2px;
}
.brand-name { font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.brand-sub {
  color: #dfdefa;
  font-weight: 600;
  font-size: 0.85rem;
  border-left: 1px solid rgba(255,255,255,0.35);
  padding-left: 0.6rem;
}
.mainnav { display: flex; gap: 1rem; flex: 1; flex-wrap: wrap; }
.navsearch input {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.28);
  color: #fff;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.9rem;
  width: 12rem;
  margin: 0;
}
.navsearch input::placeholder { color: #cfceec; }
.navsearch input:focus {
  outline: 2px solid rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.2);
}

/* On a phone the ten nav items wrap into four stacked rows and eat most of the
   screen. Scroll them on one line instead: the app is used one-handed while
   walking a site, so vertical space is the scarce thing. */
@media (max-width: 720px) {
  .mainnav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 1.1rem;
    padding-bottom: 0.15rem;
    /* Let it scroll rather than force the flex row wider than the screen. */
    flex-basis: 100%;
    min-width: 0;
  }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav a { white-space: nowrap; }
  .brand-sub { display: none; }          /* redundant next to the page heading */
  .topbar-inner { gap: 0.5rem 0.9rem; }
}
.mainnav a {
  color: #dfdefa;
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}
.mainnav a:hover { color: #fff; border-bottom-color: rgba(255,255,255,0.6); }
.signout { display: flex; align-items: center; gap: 0.6rem; }
.who { color: #dfdefa; font-size: 0.85rem; }

/* ---------- Layout ---------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left));
}
.narrow { max-width: 640px; }
h1 { font-size: 1.5rem; margin: 0.2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.6rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-block;
  border: 1px solid var(--indigo);
  background: var(--indigo);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { background: var(--indigo-dark); border-color: var(--indigo-dark); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.6);
  color: #fff;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}
.btn-ghost:hover { background: rgba(255,255,255,0.15); }
.btn-secondary { background: #fff; color: var(--indigo); }
.btn-secondary:hover { background: var(--indigo-light); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.85rem; }
.btn[disabled], .btn.disabled { opacity: 0.5; cursor: not-allowed; }

label { display: block; font-weight: 600; margin: 0.9rem 0 0.3rem; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=date], input[type=month], select, textarea {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
.field-hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.checkbox-row label { margin: 0; font-weight: 600; }
.checkbox-row input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem 1rem 1rem; }
.inline-form { display: inline; }
.form-row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; }
.form-row > div { flex: 1; min-width: 160px; }

/* ---------- Cards ---------- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

/* ---------- Public form ---------- */
.public-shell { max-width: 560px; margin: 0 auto; padding: 1rem; }

/* Full-screen photo background for the sign-up / sign-in pages. */
body.auth-photo::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  /* Per-development background when the sign-up link carries a development
     (--auth-bg); otherwise the shared default photo. */
  background-image: var(--auth-bg, url('/static/img/auth-bg.jpg'));
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}
body.auth-photo::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(16, 22, 45, 0.42) 0%, rgba(16, 22, 45, 0.72) 100%);
}
body.auth-photo .public-header {
  background: transparent;
  padding: 0.5rem 0.25rem 0;
  margin-bottom: 1rem;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}
/* Glass form: transparent card so the photo shows through, with light text. */
body.auth-photo .card {
  background: rgba(17, 22, 42, 0.34);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  color: #fff;
}
body.auth-photo .card label { color: #fff; }
body.auth-photo .card .field-hint { color: rgba(255, 255, 255, 0.72); }
body.auth-photo .card input,
body.auth-photo .card select,
body.auth-photo .card textarea {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: #fff;
}
body.auth-photo .card input::placeholder,
body.auth-photo .card textarea::placeholder { color: rgba(255, 255, 255, 0.6); }
body.auth-photo .card input:focus,
body.auth-photo .card select:focus,
body.auth-photo .card textarea:focus {
  border-color: rgba(255, 255, 255, 0.85);
  outline: none;
}
/* Native dropdown list stays readable (dark text on the browser's white menu). */
body.auth-photo .card select option { color: #1b1836; }
body.auth-photo .card .locked-field {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
}
body.auth-photo .card .privacy,
body.auth-photo .card .small,
body.auth-photo .card .checkbox-row label { color: rgba(255, 255, 255, 0.85); }
body.auth-photo .card a { color: #cdd6ff; }

/* The sign-in screens sit on a photograph, so anything outside the frosted
   card needs its own contrast — otherwise the links below it disappear into
   whatever the image happens to be doing there. */
body.auth-photo .logo-panel-product {
  background: transparent; border: 0; padding: 0.4rem 0;
}
body.auth-photo .login-wrap > p,
body.auth-photo .login-wrap > p a,
body.auth-photo p.muted,
body.auth-photo .small {
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.65);
}
body.auth-photo .login-wrap > p a { text-decoration: underline; }
/* Keep autofilled fields on-theme instead of the browser's solid white. */
body.auth-photo .card input:-webkit-autofill {
  -webkit-text-fill-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px rgba(70, 78, 120, 0.55) inset;
  transition: background-color 9999s ease-in-out 0s;
}
/* Let the photo show through the footer too, on the auth pages. */
body.auth-photo .sitefoot {
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}
.public-header {
  background: var(--indigo);
  color: #fff;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.public-header h1 { margin: 0; font-size: 1.3rem; }
.public-header .loc { color: #dfdefa; margin-top: 0.25rem; }
.pub-logo { height: 28px; width: auto; display: block; margin-bottom: 0.6rem; }
.emergency {
  background: var(--danger-bg);
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}
.emergency strong { color: var(--danger); }
.emergency .phone {
  display: inline-block;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--danger);
  text-decoration: none;
  margin-top: 0.25rem;
}
.privacy {
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
  padding-top: 1rem;
}
.confirm-ref {
  font-size: 2rem;
  font-weight: 800;
  color: var(--indigo);
  letter-spacing: 0.03em;
  background: var(--indigo-light);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  margin: 1rem 0;
}

/* ---------- Summary cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--indigo);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}
.stat .n { font-size: 1.9rem; font-weight: 800; color: var(--indigo); }
.stat .l { color: var(--muted); font-size: 0.85rem; }
.stat.alert { border-left-color: var(--danger); }
.stat.alert .n { color: var(--danger); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--indigo-tint); color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr:hover { background: var(--indigo-tint); }
td.ref a { font-weight: 700; text-decoration: none; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge-new { background: var(--indigo-light); color: var(--indigo-dark); }
.badge-progress { background: var(--warn-bg); color: var(--warn); }
.badge-closed { background: var(--ok-bg); color: var(--ok); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
/* PPM: key-value details rendered as a table, and a simple tab row. */
table.kv { width: 100%; border-collapse: collapse; }
table.kv th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.85rem;
  padding: 0.35rem 0.75rem 0.35rem 0; vertical-align: top; white-space: nowrap; width: 1%; }
table.kv td { padding: 0.35rem 0; }
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.badge-overdue { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.badge-dup { background: #eee6fb; color: #5a2ea6; }
.badge-expired { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.badge-suggested { background: var(--ok-bg); color: var(--ok); }

.filters { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters label { margin: 0 0 0.25rem; }
.filters > div { min-width: 180px; }

.detail-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 780px) { .detail-grid { grid-template-columns: 2fr 1fr; } }
.kv { margin: 0; }
.kv dt { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; margin-top: 0.6rem; }
.kv dd { margin: 0.1rem 0 0; }
.photo-thumb { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--line); margin-top: 0.5rem; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.photo-grid .photo-thumb { width: 104px; height: 104px; object-fit: cover; margin-top: 0; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--indigo-light); padding: 0 0 0.9rem 0.9rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--indigo); }
.timeline .when { color: var(--muted); font-size: 0.8rem; }

.flashes { margin-bottom: 1rem; }
.flash { padding: 0.7rem 1rem; border-radius: var(--radius); margin-bottom: 0.5rem; }
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--danger-bg); color: var(--danger); }
.flash-info { background: var(--indigo-light); color: var(--indigo-dark); }

.emailbox { background: var(--indigo-tint); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; white-space: pre-wrap; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.9rem; }

/* ---------- Conversation thread ---------- */
.thread { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.5rem; }
.msg { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.8rem; max-width: 90%; }
.msg-staff { background: var(--indigo-light); align-self: flex-start; }
.msg-resident { background: var(--indigo-tint); align-self: flex-end; border-color: var(--indigo-light); }
.msg-meta { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.25rem; }
.msg .photo-thumb { max-width: 220px; margin-top: 0.4rem; }

/* ---------- Site footer ---------- */
.sitefoot { flex-shrink: 0; background: var(--indigo-dark); color: #d9d8f0; font-size: 0.8rem; overflow-wrap: anywhere; }
.sitefoot-inner { max-width: 1100px; margin: 0 auto; padding: 1rem max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left)); display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; justify-content: space-between; }
.sitefoot a { color: #fff; }
.sitefoot .muted { color: #b7b6dd; }
.foot-meta { display: flex; flex-direction: column; gap: 0.15rem; text-align: right; }
@media (max-width: 600px) { .foot-meta { text-align: left; } }

/* ---------- Logo panel (for light/print backgrounds) ---------- */
.logo-panel { background: var(--indigo); border-radius: var(--radius); padding: 0.9rem 1rem; text-align: center; }
.logo-panel img { height: 34px; width: auto; }

/* The Indigo logo above is a white knockout and needs the dark panel. The
   ManageBetter lockup is the opposite -- dark navy artwork on a light ground --
   so it gets its own panel rather than disappearing into the indigo one. */
.logo-panel-product {
  background: var(--white);
  border: 1px solid var(--line, #e3e2f0);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  text-align: center;
}
.logo-panel-product img { width: auto; max-width: 150px; height: auto; display: inline-block; border-radius: 22px; }

/* ---------- Login ---------- */
.login-wrap { max-width: 380px; margin: 3rem auto; }
.login-wrap .brand-big { text-align: center; color: var(--indigo); font-weight: 800; font-size: 1.4rem; margin-bottom: 1.25rem; }

/* ---------- QR poster (A4 print) ---------- */
.poster {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  background: #fff;
  padding: 24mm 20mm;
  text-align: center;
  color: var(--ink);
}
.poster .p-brand { color: var(--indigo); font-weight: 800; font-size: 1.4rem; letter-spacing: 0.02em; }
.poster h1 { font-size: 2.4rem; margin: 1rem 0 0.3rem; }
.poster .p-loc { font-size: 1.3rem; color: var(--muted); margin-bottom: 1.5rem; }
.poster .qr { width: 90mm; height: 90mm; margin: 0.5rem auto 1rem; }
.poster .p-steps { font-size: 1.3rem; text-align: left; max-width: 130mm; margin: 1rem auto; }
.poster .p-steps li { margin-bottom: 0.6rem; }
.poster .p-emergency { border: 3px solid var(--danger); border-radius: 12px; padding: 1rem; margin: 1.5rem auto 0; max-width: 150mm; }
.poster .p-emergency .lbl { color: var(--danger); font-weight: 800; font-size: 1.2rem; }
.poster .p-emergency .num { font-size: 2rem; font-weight: 800; color: var(--danger); }
.print-toolbar { text-align: center; padding: 1rem; background: var(--indigo-tint); }
@media print {
  .print-toolbar { display: none; }
  body { background: #fff; }
  .poster { margin: 0; }
  @page { size: A4; margin: 0; }
}

/* ===================== Phone app (/m) =====================================
   The phone app reuses the resident design language above (.rtabs / .rtab,
   .card, .rhome-head) rather than carrying its own card and button styles,
   which would drift apart from it. Only what has no existing equivalent is
   defined here. */

.m-capture textarea { width: 100%; font-size: 1rem; }
.m-capture-row { display: flex; gap: 0.5rem; margin-top: 0.5rem; align-items: center; }
.m-capture-row select { flex: 1; margin: 0; }
.m-photo {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 0.9rem; white-space: nowrap;
  border: 1px solid var(--line-strong); border-radius: 10px; background: #fff;
  font-weight: 600; font-size: 0.9rem; cursor: pointer;
}
.m-photo input { display: none; }

.m-note { margin: 0.1rem 0 0.35rem; font-size: 1.02rem; line-height: 1.4; }
.m-thumb { max-height: 140px; border-radius: 10px; margin-top: 0.5rem; display: block; }
.m-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.m-row form { margin: 0; }
.m-overdue { border-left: 4px solid #b3261e; }
.m-open {
  display: inline-block; margin-top: 0.6rem; font-size: 0.82rem; font-weight: 600;
  text-decoration: none; padding: 0.35rem 0.7rem; border-radius: 999px;
  background: var(--indigo-light); color: var(--accent-ink, #2c2a6b);
}

/* --- Phone-friendly sizing ------------------------------------------------
   Applied only inside the phone app so the desktop screens are untouched. */

/* Every control a finger has to hit is at least 44px tall; .btn is ~40px. */
.m-view .btn,
.m-view select,
.m-view input[type=text],
.m-view input[type=email],
.m-view input[type=date] { min-height: 44px; }

/* textarea is min-height:120px globally, which eats a third of a phone screen
   for a one-line note. The capture box grows if more is typed. */
.m-view .m-capture textarea { min-height: 62px; }

/* Cards sit closer together: less scrolling to reach the bottom of a list. */
.m-view .card { padding: 0.85rem; margin-bottom: 0.65rem; border-radius: 14px; }
/* The display face is what makes this read as considered rather than
   administrative. Scoped to the phone app so the desktop screens are
   untouched. */
.m-view {
  font-family: var(--font-body);
  background: var(--ground, #f4f4fb);
}
.m-view::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background-image: url('/static/img/auth-bg.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.22;
  pointer-events: none;
}
/* The sticky header sits over that backdrop, so it needs its own ground or the
   photograph scrolls visibly behind the title. */
.m-view .rhome-head { backdrop-filter: blur(10px); }
.m-view h1.rhome-title {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 560; letter-spacing: -0.01em;
}
.m-view .eyebrow {
  text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 0.72rem; font-weight: 700; color: var(--indigo);
}
.m-view .pill-title { font-family: var(--font-display); font-weight: 600; }

/* Section pills: the three places you can go, as the resident app presents
   its actions. */
.m-pills { display: grid; gap: 0.75rem; margin: 0.2rem 0 1.1rem; }
.m-pill {
  position: relative; display: flex; align-items: center; gap: 0.9rem;
  min-height: 92px; padding: 1rem 1.15rem;
  border-radius: 22px; text-decoration: none; color: #fff;
  box-shadow: 0 16px 30px -18px rgba(30, 28, 80, 0.75);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.m-pill:active { transform: scale(0.985); box-shadow: 0 8px 18px -14px rgba(30, 28, 80, 0.8); }
.m-pill svg { width: 30px; height: 30px; flex: none; stroke: currentColor;
              fill: none; stroke-width: 1.7; stroke-linecap: round;
              stroke-linejoin: round; opacity: 0.95; }
.m-pill-text { display: flex; flex-direction: column; gap: 0.1rem; }
.m-pill-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; }
.m-pill-sub { font-size: 0.83rem; opacity: 0.85; }
.m-pill-count {
  position: absolute; top: 0.85rem; right: 1rem;
  min-width: 1.7rem; padding: 0.1rem 0.5rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.22); font-size: 0.82rem; font-weight: 700;
  text-align: center;
}
.m-pill-todo     { background: linear-gradient(150deg, #6d5be0 0%, #2a2a72 92%); }
.m-pill-jobs     { background: linear-gradient(150deg, #12b3a8 0%, #2a2a72 92%); }
.m-pill-cleaning { background: linear-gradient(150deg, #2f7bf0 0%, #17b0a6 92%); }

/* The header stays put, so the menu and the current tab are always reachable
   without scrolling back up a long list. */
.m-view .rhome-head {
  position: sticky; top: 0; z-index: 30;
  background: rgba(244, 244, 251, 0.82);
  padding-top: calc(0.6rem + env(safe-area-inset-top, 0px));
  padding-bottom: 0.5rem;
  margin-bottom: 0.2rem;
}

/* Visible to screen readers only. Carried over from the resident markup but
   never defined here, so without it the label renders as stray text. */
.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;
}

/* --- Header menu ---------------------------------------------------------- */
.m-head-actions { display: flex; align-items: center; gap: 0.4rem; }
.m-menu { position: relative; }
.m-menu > summary { list-style: none; cursor: pointer; }
.m-menu > summary::-webkit-details-marker { display: none; }
.m-menu-panel {
  position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 40;
  min-width: 13.5rem; padding: 0.5rem;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 40px -16px rgba(30, 28, 80, 0.45);
}
.m-menu-panel a,
.m-menu-signout {
  display: block; width: 100%; text-align: left;
  padding: 0.7rem 0.6rem; border-radius: 9px;
  text-decoration: none; color: var(--ink); font-size: 0.95rem;
  font-weight: 600; background: none; border: 0; cursor: pointer;
}
.m-menu-panel a:hover, .m-menu-signout:hover { background: var(--indigo-tint); }
.m-menu-signout { color: #b3261e; }

/* Destructive, so it reads as such without shouting. */
.m-view .m-danger { color: #b3261e; border-color: #f0c8c4; background: #fff; }
.m-menu-who {
  margin: 0.15rem 0.6rem 0.4rem; padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line); font-weight: 700; font-size: 0.92rem;
}
.m-menu-who span { display: block; font-weight: 400; }
.m-menu-panel form { margin: 0; }

/* ===================== Cleaning walk-round ================================
   One area per screen. Everything a thumb touches is large, and the score is
   a tap rather than a typed number — nine typed numbers is the part of an
   audit people cut corners on. */

.w-progress { display: flex; gap: 4px; margin: 0.2rem 0 0.35rem; }
.w-step {
  flex: 1; height: 5px; border-radius: 999px;
  background: var(--line-strong, #d3d2e6);
}
.w-step.done { background: var(--indigo, #3d3a8f); }
.w-step.now  { background: var(--brass-line, #c8a556); }
.w-running { margin: 0 0 0.9rem; }

.w-bands { display: grid; gap: 0.5rem; margin-bottom: 0.9rem; }
.w-band {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 58px; padding: 0 1.1rem;
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: #fff; cursor: pointer; text-align: left;
  font-family: inherit; color: var(--ink);
  transition: transform 0.1s ease;
}
.w-band:active { transform: scale(0.99); }
.w-band-label { font-size: 1.05rem; font-weight: 700; }
.w-band-value { font-size: 0.95rem; color: var(--muted); font-variant-numeric: tabular-nums; }
/* A tapped band stays marked, so returning to an area shows what was recorded. */
.w-band.on { border-color: var(--indigo); box-shadow: inset 0 0 0 1px var(--indigo); }
.w-band-1 { border-left: 6px solid #1d6a3a; }
.w-band-2 { border-left: 6px solid #4f9e5f; }
.w-band-3 { border-left: 6px solid #c8a556; }
.w-band-4 { border-left: 6px solid #d2802c; }
.w-band-5 { border-left: 6px solid #b3261e; }

.w-row { margin-bottom: 0.8rem; }
.w-photo {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; border-radius: 14px; cursor: pointer;
  border: 1px dashed var(--line-strong); background: #fff;
  font-weight: 600; color: var(--ink);
}
.w-photo input { display: none; }
.w-shots { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.w-shots img { height: 84px; border-radius: 10px; }

.w-fine { margin: 0.7rem 0 1rem; }
.w-fine summary { cursor: pointer; font-size: 0.9rem; color: var(--muted); }

.w-nav { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.w-nav .btn { flex: 1; min-height: 50px; }

.w-summary { text-align: center; }
.w-overall {
  font-family: var(--font-display, Georgia, serif);
  font-size: 3rem; line-height: 1; margin: 0.2rem 0 0.3rem;
  color: var(--indigo);
}
.w-review { margin-bottom: 1rem; }
.w-review-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  padding: 0.85rem 1rem; margin-bottom: 0.4rem;
  background: var(--surface, #fff); border: 1px solid var(--line);
  border-radius: 12px; text-decoration: none; color: inherit;
}
.w-review-area { display: flex; flex-direction: column; gap: 0.1rem; }
.w-review-score { flex: none; }

/* Area editing sits behind a disclosure so the scoring form stays the page's
   main business. */
.area-edit { margin-top: 0.5rem; }
.area-edit > summary { cursor: pointer; font-size: 0.82rem; color: var(--muted); }
.area-edit-row { display: flex; gap: 0.4rem; align-items: center; margin-top: 0.45rem; }
.area-edit-row input { flex: 1; margin: 0; }
.area-edit form + form { margin-top: 0.4rem; }
