/* Rentify web — a faithful port of the iOS design system (Theme.swift).
   Role-themed (indigo/teal/sky), SF-rounded type, 20px surface cards with a
   soft shadow, gradient hero cards, capsule badges/pills, per-role tab bar. */

:root {
  /* Brand + role tints */
  --indigo: #4f46e5; --indigo-deep: #3730a3; --violet: #7c3aed;
  --teal: #14b8a6; --emerald: #10b981; --sky: #0ea5e9;
  /* Semantic */
  --success: #10b981; --warning: #f59e0b; --danger: #f43f5e; --info: #0ea5e9;
  /* Neutrals — iOS "grouped" light: gray canvas, white cards */
  --canvas: #f2f2f7; --surface: #ffffff; --ink: #1c1c1e; --subtle: #6e6e73;
  --hairline: rgba(60, 60, 67, 0.16);
  /* Shape + elevation */
  --r-card: 20px; --r-ctrl: 14px;
  --shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  /* Spacing scale (Metrics) */
  --xs: 4px; --sm: 8px; --md: 16px; --lg: 24px; --xl: 32px;
  /* Role (overridden per data-role) */
  --role: var(--indigo);
  --role-grad: linear-gradient(135deg, #4f46e5, #7c3aed);
  --role-soft: rgba(79, 70, 229, 0.15);
}
/* Unified brand theme across ALL roles (agent/admin/owner/manager/caretaker/tenant):
   one indigo-violet accent everywhere. Per-role colors are intentionally identical
   so the app looks the same for every role; change all three to re-theme globally. */
[data-role="agent"]  { --role: var(--indigo); --role-grad: linear-gradient(135deg, #4f46e5, #7c3aed); --role-soft: rgba(79,70,229,.15); }
[data-role="owner"]  { --role: var(--indigo); --role-grad: linear-gradient(135deg, #4f46e5, #7c3aed); --role-soft: rgba(79,70,229,.15); }
[data-role="tenant"] { --role: var(--indigo); --role-grad: linear-gradient(135deg, #4f46e5, #7c3aed); --role-soft: rgba(79,70,229,.15); }

@media (prefers-color-scheme: dark) {
  :root { --canvas: #000000; --surface: #1c1c1e; --ink: #ffffff; --subtle: #98989d; --hairline: rgba(255,255,255,0.14); --shadow: 0 6px 16px rgba(0,0,0,0.5); }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--canvas); color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 16px; line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* Type ramp (rDisplay/rTitle/rHeadline/rBody/rCallout/rCaption) */
.t-display { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; }
.t-title   { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
.t-head    { font-size: 18px; font-weight: 600; }
.t-body    { font-size: 16px; }
.t-callout { font-size: 15px; font-weight: 500; }
.t-cap     { font-size: 13px; font-weight: 500; }
.subtle    { color: var(--subtle); }

/* ---- App scaffold ---------------------------------------------------------- */
#app { max-width: 720px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 12px var(--md); background: color-mix(in srgb, var(--canvas) 86%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--hairline);
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: -0.3px; }
.brand .dot { color: var(--role); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 50%; border: none; background: transparent; color: var(--ink); cursor: pointer; }
.iconbtn:hover { background: var(--role-soft); }
.iconbtn svg { width: 21px; height: 21px; }

.screen { flex: 1; padding: var(--md) var(--md) 96px; }
.section-title { font-size: 18px; font-weight: 600; margin: 18px 4px 10px; }

/* ---- Cards / heroes -------------------------------------------------------- */
.card { background: var(--surface); border-radius: var(--r-card); padding: var(--md);
  box-shadow: var(--shadow); margin-bottom: var(--md); }
.hero { background: var(--role-grad); color: #fff; border-radius: var(--r-card);
  padding: var(--lg); box-shadow: var(--shadow); margin-bottom: var(--md); }
.hero .subtle, .hero .subtle * { color: rgba(255, 255, 255, 0.85); }
.tap { cursor: pointer; }
.tap:active { transform: scale(0.985); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sm); }
.row-center { display: flex; align-items: center; gap: var(--sm); }
.divider { height: 1px; background: var(--hairline); margin: 12px 0; border: 0; }

/* Pills + badges */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: #fff; background: var(--role-grad); }
.pill svg { width: 14px; height: 14px; }
.badge { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; }
.badge svg { width: 13px; height: 13px; margin-right: 4px; }
.b-success { color: var(--success); background: color-mix(in srgb, var(--success) 15%, transparent); }
.b-warning { color: var(--warning); background: color-mix(in srgb, var(--warning) 15%, transparent); }
.b-danger  { color: var(--danger);  background: color-mix(in srgb, var(--danger) 15%, transparent); }
.b-role    { color: var(--role);    background: var(--role-soft); }

/* Avatar */
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--role-soft); color: var(--role);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.avatar svg { width: 26px; height: 26px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* "More" hub grid */
.morewrap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.morecard { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 18px 8px; background: var(--card, #fff); border: 1px solid var(--hairline); border-radius: 16px;
  cursor: pointer; color: var(--text, inherit); font: inherit; }
.morecard:active { transform: scale(.97); }
.morecard .moreic { width: 44px; height: 44px; border-radius: 12px; background: var(--role-soft); color: var(--role);
  display: flex; align-items: center; justify-content: center; }
.morecard .moreic svg { width: 22px; height: 22px; }
.morecard .morelb { font-size: 13px; font-weight: 600; text-align: center; }

/* Mini stat row (in hero) */
.ministats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--md); margin-top: var(--md); }
.ministats .v { font-size: 18px; font-weight: 700; }
.ministats .k { font-size: 13px; opacity: 0.85; }

/* Stat tiles grid */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--md); }
.tile { background: var(--surface); border-radius: var(--r-card); padding: var(--md); box-shadow: var(--shadow); }
.tile .k { font-size: 13px; color: var(--subtle); display: flex; align-items: center; gap: 6px; }
.tile .k svg { width: 15px; height: 15px; }
.tile .v { font-size: 20px; font-weight: 700; margin-top: 4px; }

/* Management tiles */
.mtile { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: var(--r-card);
  padding: 14px; box-shadow: var(--shadow); cursor: pointer; }
.mtile .ic { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mtile .ic svg { width: 18px; height: 18px; color: #fff; }
.mtile .label { flex: 1; font-weight: 600; font-size: 15px; }
.mtile .chev { color: var(--subtle); }

/* Generic list rows */
.list { display: flex; flex-direction: column; gap: var(--md); }
.rowcard { background: var(--surface); border-radius: var(--r-card); padding: var(--md); box-shadow: var(--shadow); }
.metric { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.metric .ic { width: 26px; height: 26px; display: flex; align-items: center; }
.metric .ic svg { width: 18px; height: 18px; }
.metric .k { font-size: 12px; color: var(--subtle); }
.metric .v { font-size: 15px; font-weight: 700; }
.metrics-row { display: flex; align-items: center; gap: var(--lg); }
.chev { color: var(--subtle); display: inline-flex; }
.chev svg { width: 16px; height: 16px; }

.value-pos { color: var(--success); }
.value-neg { color: var(--danger); }
.value-warn { color: var(--warning); }

/* Buttons */
.btn { font: inherit; cursor: pointer; border: none; border-radius: var(--r-ctrl); }
.btn-primary { width: 100%; padding: 14px; background: var(--role); color: #fff; font-size: 17px; font-weight: 700;
  box-shadow: var(--shadow); }
.btn-primary:disabled { background: #b8b8bf; cursor: default; box-shadow: none; }
.btn-primary:active:not(:disabled) { transform: scale(0.97); }
.btn-ghost { padding: 9px 14px; background: transparent; border: 1px solid var(--hairline); color: var(--ink); font-weight: 600; }
.btn-link { background: none; border: none; color: var(--role); font-weight: 600; cursor: pointer; padding: 8px; }

/* Inputs */
.field { width: 100%; padding: 13px 14px; border-radius: var(--r-ctrl); border: 1px solid var(--hairline);
  background: var(--surface); color: var(--ink); font: inherit; margin: 6px 0; }
.field:focus { outline: none; border-color: var(--role); box-shadow: 0 0 0 3px var(--role-soft); }

/* Filter pills (tickets) */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; -ms-overflow-style: none; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.fpill { white-space: nowrap; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--hairline);
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.fpill.active { background: var(--role); color: #fff; border-color: var(--role); }

/* Empty state */
.empty { text-align: center; padding: var(--xl) var(--md); color: var(--subtle); }
.empty .ic { color: color-mix(in srgb, var(--role) 60%, transparent); margin-bottom: 10px; }
.empty .ic svg { width: 44px; height: 44px; }
.empty .et { font-size: 18px; font-weight: 600; color: var(--ink); }

/* Priority dot */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---- Tab bar --------------------------------------------------------------- */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--canvas) 88%, transparent); backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px); border-top: 1px solid var(--hairline);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
.tabbar-inner { max-width: 720px; width: 100%; margin: 0 auto; display: flex; justify-content: space-around; }
.tab { flex: 1; background: none; border: none; cursor: pointer; color: var(--subtle); display: flex; flex-direction: column;
  align-items: center; gap: 3px; padding: 4px 0; font-size: 10px; font-weight: 600; }
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--role); }

/* ---- Login ----------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--lg); max-width: 460px; margin: 0 auto; }
.login-logo { width: 76px; height: 76px; border-radius: 22px; background: var(--role-grad); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); margin-bottom: var(--md); }
.login-logo svg { width: 40px; height: 40px; }
.login-card { width: 100%; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 6px; }
.center { text-align: center; }
a { color: var(--role); }

/* ---- Auth (login / onboarding / role picker) ------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-aside { background: var(--role-grad); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside .brandline { font-weight: 800; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.auth-aside .mark { width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; }
.auth-aside .mark svg { width: 21px; height: 21px; }
.auth-aside h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.6px; margin: 0 0 22px; font-weight: 800; }
.auth-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.auth-points li svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; opacity: .95; }
.auth-aside .foot { font-size: 13px; opacity: .82; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--canvas); }
.auth-card { width: 100%; max-width: 430px; }
.auth-card h2 { font-size: 25px; letter-spacing: -.5px; margin: 0 0 6px; font-weight: 800; }
.auth-card .lead { color: var(--subtle); font-size: 15px; margin: 0 0 20px; line-height: 1.5; }
.label { font-size: 13px; font-weight: 600; color: var(--subtle); margin: 14px 0 6px; display: block; }
.phone-row { display: flex; gap: 8px; }
.cc-wrap { position: relative; }
.cc-btn { display: flex; align-items: center; gap: 7px; padding: 0 12px; height: 50px; border: 1px solid var(--hairline);
  border-radius: var(--r-ctrl); background: var(--surface); cursor: pointer; font: inherit; font-weight: 600; white-space: nowrap; color: var(--ink); }
.cc-btn:hover { border-color: var(--role); }
.cc-btn .fl { font-size: 20px; line-height: 1; }
.cc-btn .ch { color: var(--subtle); display: inline-flex; }
.cc-btn .ch svg { width: 14px; height: 14px; }
.phone-input { flex: 1; height: 50px; padding: 0 14px; border: 1px solid var(--hairline); border-radius: var(--r-ctrl);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; }
.phone-input:focus { outline: none; border-color: var(--role); box-shadow: 0 0 0 3px var(--role-soft); }
.cc-pop { position: absolute; z-index: 60; margin-top: 6px; width: 300px; max-width: 86vw; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.cc-search { width: 100%; border: none; border-bottom: 1px solid var(--hairline); padding: 13px 14px; font: inherit; background: transparent; color: var(--ink); }
.cc-search:focus { outline: none; }
.cc-list { max-height: 280px; overflow-y: auto; }
.cc-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; font-size: 14px; }
.cc-item:hover { background: var(--role-soft); }
.cc-item .fl { font-size: 18px; }
.cc-item .nm { flex: 1; }
.cc-item .dc { color: var(--subtle); font-weight: 600; }
.help { display: flex; gap: 10px; background: var(--role-soft); border-radius: 14px; padding: 12px 14px; margin-top: 16px; font-size: 13px; line-height: 1.5; }
.help svg { width: 18px; height: 18px; color: var(--role); flex-shrink: 0; margin-top: 1px; }
.help b { font-weight: 700; }
.otp-input { width: 100%; height: 58px; text-align: center; font-size: 24px; letter-spacing: 12px; font-weight: 700; text-indent: 12px;
  border: 1px solid var(--hairline); border-radius: var(--r-ctrl); background: var(--surface); color: var(--ink); font-variant-numeric: tabular-nums; }
.otp-input:focus { outline: none; border-color: var(--role); box-shadow: 0 0 0 3px var(--role-soft); }
.linkrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; }
.muted-btn { background: none; border: none; color: var(--subtle); font: inherit; font-weight: 600; cursor: pointer; font-size: 14px; padding: 0; }
.muted-btn:hover:not(:disabled) { color: var(--ink); }
.muted-btn:disabled { opacity: .55; cursor: default; }
.muted-btn svg { width: 15px; height: 15px; }
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 4px; }
.role-card { border: 1.5px solid var(--hairline); border-radius: 16px; padding: 16px; cursor: pointer; background: var(--surface); transition: border-color .15s, transform .15s; }
.role-card:hover { transform: translateY(-2px); }
.role-card.sel { border-color: var(--role); box-shadow: 0 0 0 3px var(--role-soft); }
.role-card .ic { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.role-card .ic svg { width: 22px; height: 22px; color: #fff; }
.role-card .rt { font-weight: 700; font-size: 15px; }
.role-card .rs { font-size: 12px; color: var(--subtle); margin-top: 2px; }
@media (max-width: 820px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}

/* ---- Sheet (modal form) ---------------------------------------------------- */
.sheet-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(10,12,20,.45); display: flex; align-items: flex-end; justify-content: center; animation: fadein .15s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 560px) { .sheet-overlay { align-items: center; padding: 20px; } }
.sheet { background: var(--surface); width: 100%; max-width: 480px; border-radius: 22px 22px 0 0; max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
@media (min-width: 560px) { .sheet { border-radius: 22px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--hairline); }
.sheet-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
.sheet-body { padding: 16px 18px; overflow-y: auto; }
.sheet-foot { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--hairline); }
.sheet-foot .btn { flex: 1; }
.sheet .error { padding: 0 18px; }
.f-label { font-size: 13px; font-weight: 600; color: var(--subtle); margin: 14px 0 5px; display: block; }
.f-label:first-child { margin-top: 0; }
.sheet textarea.field { min-height: 74px; resize: vertical; font-family: inherit; }
.sheet select.field { height: 48px; appearance: none; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 70px; padding: 9px 8px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--role); color: #fff; border-color: var(--role); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; cursor: pointer; }
.switch .tk { width: 46px; height: 28px; border-radius: 999px; background: var(--hairline); position: relative; transition: background .15s; flex-shrink: 0; }
.switch .tk::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on .tk { background: var(--role); }
.switch.on .tk::after { transform: translateX(18px); }
.switch .sw-label { font-size: 14px; font-weight: 600; }
.checklist { display: flex; flex-direction: column; gap: 2px; max-height: 200px; overflow-y: auto; border: 1px solid var(--hairline); border-radius: 12px; padding: 6px; }
.chk { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.chk:hover { background: var(--role-soft); }
.chk .box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--hairline); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.chk.on .box { background: var(--role); border-color: var(--role); }
.chk .box svg { width: 13px; height: 13px; }

/* ---- Quick actions --------------------------------------------------------- */
.qa { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 6px; margin-bottom: 6px; scrollbar-width: none; }
.qa::-webkit-scrollbar { display: none; }
.qa button { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px; padding: 12px 14px; min-width: 80px; cursor: pointer; font: inherit; color: var(--ink); transition: transform .15s, border-color .15s; }
.qa button:hover { border-color: var(--role); transform: translateY(-2px); }
.qa .qi { width: 38px; height: 38px; border-radius: 11px; background: var(--role-soft); color: var(--role); display: flex; align-items: center; justify-content: center; }
.qa .qi svg { width: 20px; height: 20px; }
.qa .ql { font-size: 12px; font-weight: 600; white-space: nowrap; }

/* row actions + member chips */
.rowact { display: flex; gap: 4px; }
.rowact .iconbtn { width: 32px; height: 32px; }
.rowact .iconbtn svg { width: 17px; height: 17px; }
.mrole { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--role-soft); color: var(--role); }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 200; background: #1c1c1e; color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: fadein .15s ease; }
.note-row { padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.note-row .meta { font-size: 12px; color: var(--subtle); font-weight: 600; }
.note-row.internal { background: rgba(245,158,11,.08); border-radius: 10px; padding: 10px 12px; }

/* invoice preview */
.invoice { color: var(--ink); font-size: 14px; }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--role); padding-bottom: 14px; }
.inv-biz { font-size: 18px; font-weight: 800; }
.inv-sub { color: var(--subtle); font-size: 12px; }
.inv-title { font-size: 20px; font-weight: 800; color: var(--role); }
.inv-meta { display: flex; justify-content: space-between; margin: 16px 0; }
.inv-table { width: 100%; border-collapse: collapse; }
.inv-table th, .inv-table td { padding: 9px 6px; border-bottom: 1px solid var(--hairline); text-align: left; }
.inv-table tfoot td { border-top: 2px solid var(--ink); border-bottom: none; }
.inv-foot { margin-top: 18px; color: var(--subtle); font-size: 13px; }

/* attachment thumbnails */
.rowthumb { width: 34px; height: 34px; border-radius: 8px; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: var(--role-soft); color: var(--role); cursor: pointer; flex-shrink: 0; }
.rowthumb img { width: 100%; height: 100%; object-fit: cover; }
.rowthumb svg { width: 16px; height: 16px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { width: 92px; height: 92px; border-radius: 12px; overflow: hidden; background: var(--role-soft); color: var(--role); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 22px; height: 22px; }

/* letterhead + report tables (on-screen preview; print window has its own CSS) */
.lh { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid var(--role); padding-bottom: 12px; margin-bottom: 8px; }
.lh-logo { height: 48px; max-width: 150px; object-fit: contain; border-radius: 8px; }
.lh-name { font-size: 19px; font-weight: 800; }
.lh-sub { font-size: 12px; color: var(--subtle); }
.doc-h1 { font-size: 18px; margin: 14px 0 2px; }
.doc-sub { color: var(--subtle); font-size: 13px; margin: 0 0 12px; }
.inv-meta2 { display: flex; justify-content: space-between; margin: 14px 0; font-size: 14px; }
table.rpt { width: 100%; border-collapse: collapse; font-size: 13px; }
table.rpt th { text-align: left; padding: 8px 8px; border-bottom: 2px solid var(--hairline); color: var(--subtle); font-weight: 600; white-space: nowrap; }
table.rpt td { padding: 7px 8px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
table.rpt tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: none; }
table.rpt .right { text-align: right; }
.doc-foot { margin-top: 18px; color: var(--subtle); font-size: 13px; }

.logo-prev { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.logo-prev img { height: 56px; max-width: 150px; object-fit: contain; border-radius: 10px; border: 1px solid var(--hairline); background: var(--card); padding: 5px; }

.b-info { color: var(--role); background: color-mix(in srgb, var(--role) 15%, transparent); }
.qr-wrap { display: flex; justify-content: center; }
.qr-wrap img { border-radius: 12px; background: #fff; padding: 8px; }

/* On-screen invoice preview — render as a white "paper" sheet regardless of theme */
.invprev { background: #fff; color: #111; border-radius: 12px; padding: 22px; box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.invprev .lh-logo { height: 48px; max-width: 150px; object-fit: contain; border-radius: 8px; }
.invprev .inv-head { display: flex; justify-content: space-between; gap: 20px; }
.invprev .inv-col { font-size: 12px; color: #333; max-width: 48%; line-height: 1.5; }
.invprev .inv-col .nm { font-size: 16px; font-weight: 800; color: #0b1020; margin: 2px 0 3px; }
.invprev .inv-col .lbl, .invprev .inv-billto .lbl { font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: #8a8a8a; margin-bottom: 2px; }
.invprev .inv-title { font-size: 24px; font-weight: 800; color: #0b1020; letter-spacing: .04em; }
.invprev .inv-no { color: #555; font-size: 12px; margin: 2px 0 6px; }
.invprev .inv-bal .k { font-size: 10px; color: #888; } .invprev .inv-bal .v { font-size: 18px; font-weight: 800; color: #0b1020; }
.invprev .inv-billto { font-size: 12.5px; }
.invprev .inv-meta { display: flex; flex-wrap: wrap; gap: 5px 18px; justify-content: flex-end; font-size: 11.5px; color: #444; margin: 10px 0 12px; }
.invprev table.itbl { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 12px; }
.invprev table.itbl th { background: #262b4d; color: #fff; text-align: left; padding: 8px; font-weight: 600; }
.invprev table.itbl th.r, .invprev table.itbl td.r { text-align: right; }
.invprev table.itbl td { padding: 8px; border-bottom: 1px solid #eee; vertical-align: top; }
.invprev .idesc { color: #666; font-size: 10.5px; margin-top: 3px; line-height: 1.55; }
.invprev table.inv-tot { width: 100%; margin-top: 8px; font-size: 13px; border-collapse: collapse; }
.invprev table.inv-tot td { padding: 5px 8px; } .invprev .inv-tot td.r { text-align: right; }
.invprev table.inv-tot tr.grand td { font-weight: 800; font-size: 14px; border-top: 2px solid #111; }
.invprev .words { font-size: 12px; color: #333; margin-top: 14px; line-height: 1.6; }
.invprev .sign { margin-top: 40px; text-align: right; font-size: 12.5px; }
.invprev .sign .ln { border-top: 1px solid #999; display: inline-block; padding-top: 4px; min-width: 190px; text-align: center; }
.invprev .paybox { margin-top: 14px; border: 1px solid #e3e3ee; border-radius: 8px; padding: 10px 12px; background: #fafaff; font-size: 11.5px; color: #333; }
.invprev .paytitle { font-weight: 700; color: #0b1020; margin-bottom: 4px; font-size: 12px; }
.invprev .payrow { line-height: 1.6; }

/* Caretaker quick actions */
.care-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.care-act { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border: 1px solid var(--hairline); border-radius: 14px; background: var(--card); color: var(--text); cursor: pointer; font-size: 12.5px; font-weight: 600; }
.care-act:active { transform: scale(.98); }
.care-act .ci { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--role) 14%, transparent); color: var(--role); }
.care-act .ci svg { width: 20px; height: 20px; }

/* Caretaker reading card inside the New-bill sheet */
.f-info { margin: 4px 0 10px; }
.care-read { border: 1px solid color-mix(in srgb, var(--role) 35%, transparent); border-radius: 12px; padding: 12px; background: color-mix(in srgb, var(--role) 7%, transparent); }
.care-read-img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; cursor: zoom-in; border: 1px solid var(--hairline); }

/* Signature pad (caretaker visitor capture) */
.sigpad-wrap { position: relative; }
.sigpad { width: 100%; height: 120px; border: 1px dashed var(--hairline); border-radius: 12px; background: #fff; touch-action: none; display: block; }
.sig-clear { position: absolute; top: 6px; right: 8px; background: rgba(255,255,255,.85); border: 1px solid var(--hairline); border-radius: 8px; padding: 3px 10px; font-size: 12px; color: #333; cursor: pointer; }

/* Subscription plan feature list */
.plan-feat { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 5px; }
.plan-feat li { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); }
.plan-feat li svg { width: 15px; height: 15px; color: var(--success); flex: none; }

/* Login: terms agreement + support */
.agree { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; font-size: 13px; color: var(--subtle, #667); line-height: 1.5; cursor: pointer; }
.agree input[type="checkbox"] { width: 18px; height: 18px; margin-top: 1px; flex: none; accent-color: var(--role, #4f46e5); }
.agree a { color: var(--role, #4f46e5); font-weight: 600; text-decoration: none; }
.agree a:hover { text-decoration: underline; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.login-support { margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--subtle, #889); }
.login-support a { color: var(--role, #4f46e5); font-weight: 600; text-decoration: none; }

/* Defensive: any stray image stays within its container (prevents giant overflows). */
#screen img, .sheet img { max-width: 100%; }

/* Dashboard business-logo avatar with a small "change" badge. */
.dash-avatar { position: relative; display: inline-flex; }
.avatar-edit { position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--role); color: #fff; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--card, #fff); }
.avatar-edit svg { width: 10px; height: 10px; }

/* Owner chip (photo + name) on dashboard property cards and the property page. */
.ownerchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 999px;
  background: var(--role-soft); color: var(--ink, #0b1020); font-size: 12px; font-weight: 600; max-width: 100%; }
.ownerchip .avatar { background: var(--card, #fff); }
.ownerchip.on-hero { background: rgba(255,255,255,.16); color: #fff; }
.ownerchip.on-hero .avatar { background: rgba(255,255,255,.25); color: #fff; }

/* Property photo banner on the property page. */
.prop-photo { width: 100%; height: 168px; border-radius: 16px; overflow: hidden; margin-bottom: 12px;
  background: var(--role-soft); cursor: zoom-in; }
.prop-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Shared-unit tenant group on the Tenants page. */
.tgroup { border: 1px solid var(--hairline); border-radius: 16px; overflow: hidden; margin-bottom: 12px;
  background: color-mix(in srgb, var(--role) 4%, transparent); }
.tgroup-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--hairline); }
.tgroup-head svg { width: 18px; height: 18px; color: var(--role); }
.tgroup-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.tgroup-body .rowcard.tmember { margin: 0; background: var(--card, #fff); }

/* ---- Fast onboarding: bulk unit builder, wizard, tenant quick-attach ---- */
.bigsheet { max-width: 700px; }
@media (min-width: 560px) { .bigsheet { width: calc(100vw - 40px); } }
.bb-mode { margin-bottom: 12px; }
.bb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 6px 0 4px; }
.bb-grid label { display: block; font-size: 12px; color: var(--subtle); margin-bottom: 4px; }
.bb-f { width: 100%; height: 36px; padding: 6px 9px; font: inherit; font-size: 13px; border: 1px solid var(--hairline);
  border-radius: 10px; background: var(--card, #fff); color: var(--text, #0b1020); }
select.bb-f { appearance: none; }
.bb-chk { display: inline-flex; align-items: center; gap: 7px; height: 36px; font-size: 13px; color: var(--text); cursor: pointer; }
.bb-chk input { width: 17px; height: 17px; accent-color: var(--role); }
.bb-defhdr { margin: 14px 0 2px; font-size: 13px; font-weight: 600; }
.bb-defhdr .subtle { font-weight: 400; }
.bb-prevhdr { margin: 14px 0 6px; font-size: 13px; }
.bb-count { display: inline-block; background: var(--role-soft); color: var(--role); font-weight: 700;
  border-radius: 999px; padding: 2px 10px; margin-right: 4px; }
.bb-tbl { border: 1px solid var(--hairline); border-radius: 12px; overflow: hidden; max-height: 340px; overflow-y: auto; }
.bb-h, .bb-r { display: grid; grid-template-columns: 1.3fr 1fr 1fr 34px; gap: 8px; align-items: center; padding: 7px 10px; }
.bb-h { position: sticky; top: 0; z-index: 1; background: var(--role-soft); font-size: 12px; color: var(--subtle); }
.bb-r { border-top: 1px solid var(--hairline); font-size: 13px; }
.bb-r .bb-nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-r.dup { opacity: .5; }
.bb-r.edited { background: color-mix(in srgb, var(--warning) 12%, transparent); }
.bb-rm { width: 30px; height: 30px; }
.bb-rm svg { width: 15px; height: 15px; }
.bb-h.ta, .bb-r.ta { grid-template-columns: 1fr 1.4fr 1fr .9fr .9fr; }

.wiz-steps { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.wiz-step { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--subtle); }
.wiz-step b { width: 21px; height: 21px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--role-soft); color: var(--ink, #0b1020); font-weight: 700; font-size: 11px; }
.wiz-step b svg { width: 12px; height: 12px; }
.wiz-step.on { color: var(--text); font-weight: 600; }
.wiz-step.on b { background: var(--role); color: #fff; }
.wiz-step.done b { background: var(--success); color: #fff; }
.wiz-h { font-weight: 700; font-size: 15px; margin: 2px 0 12px; }
.wiz-note { margin-top: 12px; color: var(--success); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.wiz-note svg { width: 16px; height: 16px; }

/* Base icon size: any icon dropped into a plain text row (e.g. the property
   address line, dashboard chevrons/tenant-due icons) renders as a small inline
   glyph instead of the browser's ~300px SVG default. Every per-component rule
   above (.iconbtn svg, .pill svg, .empty .ic svg, …) is more specific and wins,
   so sized icons are unaffected. */
svg { width: 16px; height: 16px; flex: none; vertical-align: -2px; }

/* Owner card: portfolio (property names) chips under the metrics row. */
.ownerprops { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.ownerprops .ownerchip { padding: 4px 10px; }

/* Builder preview header: count on the left, "+ Add unit" (manual row) on right. */
.bb-prevhdr { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bb-addrow { width: auto !important; padding: 4px 6px !important; }
.bb-r.m.dup [data-mname] { color: var(--danger); }

/* PG bulk builder: extra Beds column. */
.bb-tbl.pg .bb-h, .bb-tbl.pg .bb-r { grid-template-columns: 1.2fr .9fr .9fr .6fr 34px; }

/* Duplicate-phone flag: in-form banner + bulk-row highlight. */
.dupwarn { margin-top: 2px; }
.dupwarn-in { display: flex; gap: 9px; align-items: flex-start; padding: 10px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); }
.dupwarn-in .di { color: var(--warning); flex: none; margin-top: 1px; }
.bb-f.dupflag { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); }

/* Global property/owner filter bar (under the top bar, tab views only). */
.gfbar { display: flex; align-items: center; gap: 8px; padding: 8px 16px 0; }
.gfchip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--card, #fff); color: var(--ink, #0b1020); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.gfchip.on { background: var(--role-soft); border-color: var(--role); color: var(--role); }
.gfchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.gfclear { width: 30px; height: 30px; }
