/* Rentleey web app. Phone first (app look: top bar + bottom tabs); from 900px wide, a side menu. */
:root {
  --blue: #0225ff; --blue-dark: #0019b8; --blue-soft: #eef1ff;
  --ink: #0b1033; --muted: #4a5170; --line: #e3e6f2;
  --bg: #ffffff; --bg-alt: #f6f7fc;
  --green: #007843; --orange: #b86e00; --red: #c42b1c;
  --head: 'League Spartan', system-ui, sans-serif;
  --body: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 14px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.5 var(--body); color: var(--ink); background: var(--bg-alt); -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); }
h1, h2 { font-family: var(--head); line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead { color: var(--muted); font-size: 1.05rem; }
[hidden] { display: none !important; }
.ico { width: 24px; height: 24px; flex: none; }

/* Cards, buttons, forms */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font: 600 1rem var(--body); text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.card .btn { margin-top: 4px; }
.link { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; text-decoration: underline; cursor: pointer; }
.stack { display: grid; gap: 10px; margin: 0 0 16px; }
.stack .btn { width: 100%; margin-top: 6px; }
label { font-weight: 600; font-size: .95rem; }
input[type=tel], input[type=text], input[inputmode], select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; font: 500 1.1rem var(--body); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .choice:focus-visible, a:focus-visible { outline: 3px solid rgba(2, 37, 255, .35); outline-offset: 2px; border-color: var(--blue); }
.code-input { letter-spacing: .5em; text-align: center; font-size: 1.6rem !important; font-weight: 700 !important; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--blue); flex: none; }
.inline-form { margin: 0 0 8px; }
.notice { padding: 12px 14px; border-radius: 10px; font-size: .95rem; }
.notice.error { background: #fdecea; color: var(--red); }
.notice.ok { background: #e6f4ec; color: var(--green); }
.notice.info { background: var(--blue-soft); color: var(--blue-dark); }

/* Lists and status chips */
.list { list-style: none; margin: 0 0 12px; padding: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; background: var(--bg-alt); color: var(--muted); }
.chip.green { background: #e6f4ec; color: var(--green); }
.chip.blue { background: var(--blue-soft); color: var(--blue-dark); }
.chip.orange { background: #fff4e0; color: var(--orange); }
.chip.red { background: #fdecea; color: var(--red); }
.empty-state { text-align: center; color: var(--muted); padding: 8px 0 12px; }
.empty-state .ico { width: 40px; height: 40px; color: var(--blue); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

/* Logged-out pages: one centred card */
.plain-main { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px calc(24px + var(--safe-b)); }
.plain-logo { margin: 0 0 20px; height: auto; }
.plain-card { width: 100%; max-width: 420px; padding: 28px 22px; }
.foot-links { margin-top: 16px; font-size: .85rem; color: var(--muted); }
.foot-links a { color: var(--muted); }
.choices { display: grid; gap: 12px; }
.choice { display: flex; gap: 14px; align-items: center; text-align: left; width: 100%; padding: 16px; border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff; font: inherit; color: inherit; cursor: pointer; }
.choice:hover { border-color: var(--blue); background: var(--blue-soft); }
.choice .ico { width: 32px; height: 32px; color: var(--blue); }
.choice b { display: block; font-size: 1.05rem; }
.choice small { color: var(--muted); font-size: .9rem; }

/* Logged-in app: phone layout */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px; padding-top: env(safe-area-inset-top, 0px); background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; }
.brand img { height: 24px; width: auto; }
.side-label { font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--bg-alt); padding: 3px 10px; border-radius: 99px; }
.switch { margin-left: auto; }
.switch button { background: none; border: 0; color: var(--blue); font: 600 .875rem var(--body); cursor: pointer; padding: 8px 0; }
.content { padding: 20px 16px calc(var(--tabbar-h) + 24px + var(--safe-b)); max-width: 720px; margin: 0 auto; }
.page-title { font-size: 1.6rem; }
.sidenav { display: none; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--bg); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
.tab.on { color: var(--blue); }
/* Opened from the home screen icon: no browser bar, so give the top a little more room */
@media (display-mode: standalone) { .topbar { height: calc(56px + env(safe-area-inset-top, 0px)); } }

/* Desktop: side menu instead of bottom tabs */
@media (min-width: 900px) {
  body.app { display: grid; grid-template-columns: 240px 1fr; grid-template-rows: 64px 1fr; min-height: 100vh; }
  .topbar { grid-column: 1 / -1; height: 64px; padding: 0 28px; }
  .brand img { height: 28px; }
  .sidenav { display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; background: var(--bg); border-right: 1px solid var(--line); position: sticky; top: 64px; height: calc(100vh - 64px); }
  .navlink { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; }
  .navlink:hover { background: var(--bg-alt); color: var(--ink); }
  .navlink.on { background: var(--blue-soft); color: var(--blue); }
  .tabbar { display: none; }
  .content { padding: 32px 40px 48px; max-width: 960px; margin: 0; }
  .page-title { font-size: 2rem; }
  .card { padding: 24px 28px; }
  .stack .btn { width: auto; justify-self: start; }
}

/* ── Stage 1: landlord pages ── */
textarea { width: 100%; padding: 12px 14px; font: 500 1rem var(--body); color: var(--ink); border: 1.5px solid var(--line); border-radius: 12px; background: #fff; resize: vertical; }
select { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' fill='none' stroke='%234a5170' stroke-width='2'%3E%3Cpath d='M1 1l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 16px center; padding-right: 40px; }
.form label { margin-top: 6px; }
.radio-group { border: 0; padding: 0; margin: 6px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }
.radio-group legend { font-weight: 600; font-size: .95rem; margin-bottom: 8px; padding: 0; }
.radio { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 12px; font-weight: 600; cursor: pointer; }
.radio input { width: 20px; height: 20px; accent-color: var(--blue); }
.radio:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.caretaker-fields, .area-other { display: grid; gap: 10px; }
/* Only show the caretaker and "other area" boxes when they're needed (browsers without :has show them always). */
@supports selector(:has(*)) {
  .form:not(:has(input[value="caretaker"]:checked)) .caretaker-fields { display: none; }
  .form:not(:has(option[value="Other"]:checked)) .area-other { display: none; }
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; }
.act { margin: 0; }
.act .btn { margin: 0; }
.act .btn small { display: block; font-weight: 500; font-size: .8rem; color: var(--muted); }
.section-title { font-size: 1.05rem; color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.count { background: var(--orange); color: #fff; border-radius: 99px; font-size: .8rem; padding: 1px 9px; font-family: var(--body); }
.todo { border-left: 4px solid var(--blue); }
.todo-tenant, .todo-viewing { border-left-color: var(--green); }
.todo-verify, .todo-details { border-left-color: #fa9d00; }
.todo h2 { font-size: 1.1rem; }
.todo p { margin: 0 0 .5em; }
.flash { background: #f2fbf6; border-color: #bfe5cf; }
.reply + .reply { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.reply p:last-child { margin-bottom: 0; }
.media { margin: 0 0 12px; }
.media video, .media img { width: 100%; max-height: 70vh; border-radius: 12px; background: #000; display: block; }
.media figcaption { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.houses { display: grid; gap: 16px; }
.house { padding: 0; overflow: hidden; }
.house-media { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #0b1033; display: block; }
.house-body { padding: 18px 20px; }
.house-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.house-head h2 { font-size: 1.1rem; margin: 0 0 8px; }
.house p { margin: 0 0 .35em; color: var(--muted); }
.item + .item { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.item h3 { font-size: 1rem; margin: 0 0 4px; }
.item p { margin: 0 0 .35em; color: var(--muted); }
.progress { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; margin: 0 0 18px; font-size: .78rem; color: var(--muted); text-align: center; }
.progress li { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.progress span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); font-weight: 700; background: #fff; }
.progress .done span { background: var(--green); border-color: var(--green); color: #fff; }
.progress .now { color: var(--blue); font-weight: 700; }
.progress .now span { border-color: var(--blue); color: var(--blue); }
.steps-list { padding-left: 20px; }
.steps-list li { margin-bottom: 6px; }
.file-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 120px; padding: 18px; border: 2px dashed #c5cbe3; border-radius: var(--radius); background: var(--bg-alt); text-align: center; cursor: pointer; font-weight: 600; color: var(--blue); }
.file-drop input { max-width: 100%; font: inherit; color: var(--muted); }
.conversation .answer { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
@media (min-width: 900px) {
  .content { max-width: 1100px; }
  .grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
  .houses { grid-template-columns: repeat(2, 1fr); }
}
/* The browser's file picker won't shrink on its own: keep upload boxes inside the card on narrow phones. */
.stack { grid-template-columns: minmax(0, 1fr); }
.file-drop { width: 100%; min-width: 0; overflow: hidden; }
.file-drop input { width: 100%; }

/* ── Stage 2: tenant pages ── */
.guest .content { padding-bottom: 40px; max-width: 1100px; }
.login-btn { min-height: 40px; padding: 0 18px; }
.guest-ll { margin-left: auto; margin-right: 12px; font-weight: 600; white-space: nowrap; }
a.choice { text-decoration: none; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 14px; }
.filter { display: grid; gap: 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.filter select { min-height: 46px; font-size: .95rem; text-transform: none; letter-spacing: 0; padding: 8px 36px 8px 12px; }
.filter:last-of-type { grid-column: 1 / -1; }
.home-grid { display: grid; gap: 16px; }
.home-card { display: block; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; text-decoration: none; transition: box-shadow .15s, transform .15s; }
.home-card:hover { box-shadow: 0 8px 24px rgba(11, 16, 51, .08); transform: translateY(-2px); }
.home-pic { position: relative; aspect-ratio: 4 / 3; background: var(--blue-soft); }
.home-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.no-pic { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--blue); font-weight: 600; }
.no-pic .ico { width: 44px; height: 44px; }
.verified, .has-video { position: absolute; top: 10px; padding: 4px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; }
.verified { left: 10px; background: #fff; color: var(--green); }
.has-video { right: 10px; background: rgba(11, 16, 51, .75); color: #fff; }
.home-info { padding: 14px 16px 16px; }
.home-info h2 { font-size: 1.1rem; margin: 0 0 4px; }
.home-area { color: var(--muted); font-size: .9rem; margin: 0 0 8px; }
.home-rent { margin: 0 0 8px; color: var(--muted); }
.home-rent b { font-family: var(--head); font-size: 1.35rem; color: var(--ink); }
.home-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .85rem; color: var(--muted); }
.home-total b { color: var(--blue); font-size: 1.1rem; white-space: nowrap; }
.home-detail { display: grid; gap: 16px; }
.home-video { width: 100%; border-radius: var(--radius); background: #000; max-height: 70vh; display: block; }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; padding-bottom: 4px; scroll-snap-type: x mandatory; }
.photo-strip img { height: 110px; width: auto; border-radius: 10px; scroll-snap-align: start; display: block; }
.cost { margin: 14px 0; }
.cost > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cost dt small { display: block; color: var(--muted); font-size: .8rem; }
.cost dd { margin: 0; font-weight: 700; white-space: nowrap; }
.cost .total { border-bottom: 0; font-family: var(--head); font-size: 1.25rem; }
.cost .total dd { color: var(--blue); }
.cost-card .btn.primary, .cost-card .act .btn { width: 100%; }
.progress.three { grid-template-columns: repeat(3, 1fr); }
.pay-btn { width: 100%; margin: 6px 0 4px; font-size: 1.05rem; }
@media (min-width: 640px) {
  .home-grid { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: repeat(3, 1fr); }
  .filter:last-of-type { grid-column: auto; }
}
@media (min-width: 1100px) { .home-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) {
  body.app.guest { display: block; }
  .guest .content { margin: 0 auto; padding: 32px 40px 48px; }
  .home-detail { grid-template-columns: 1.5fr 1fr; align-items: start; }
  .cost-card { position: sticky; top: 84px; }
}
/* Long titles beside a status label: let the label drop under the title instead of squeezing it. */
.house-head { flex-wrap: wrap; }
.house-head > :first-child { flex: 1 1 220px; min-width: 0; }
.no-media { aspect-ratio: 16 / 9; border-radius: var(--radius); background: var(--blue-soft); color: var(--blue); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 16px; font-weight: 600; }
.no-media .ico { width: 44px; height: 44px; }
.no-media p { margin: 0; }
