/* Property Manager — mobile-first, readability standard: body ≥16px,
   touch targets ≥48px, no horizontal scrolling at any width. */
:root {
  --green: #1d5c3f; --green-dark: #14452e; --ink: #17211b; --muted: #5a6a60;
  --line: #d8e0da; --bg: #f4f7f4; --card: #ffffff; --red: #b3261e; --amber: #8a5a00;
  --amber-bg: #fdf3e0; --red-bg: #fdecea; --green-bg: #e7f2ea; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px; line-height: 1.45; color: var(--ink); background: var(--bg);
  overflow-x: hidden; -webkit-text-size-adjust: 100%;
}
.boot { padding: 3rem 1.25rem; text-align: center; color: var(--muted); }
h1 { font-size: 1.45rem; margin: 0.2rem 0 0.6rem; }
h2 { font-size: 1.2rem; margin: 1.1rem 0 0.5rem; }
h3 { font-size: 1.05rem; margin: 0.9rem 0 0.4rem; }
p { margin: 0.45rem 0; }
a { color: var(--green); }
.small { font-size: 0.92rem; color: var(--muted); }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 1rem 5.5rem; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--green); color: #fff;
  display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem;
}
.topbar .brand { font-weight: 700; font-size: 1.08rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar button { background: transparent; border: 0; color: #fff; font-size: 1.35rem; min-width: 48px; min-height: 48px; border-radius: 10px; cursor: pointer; }
.badge { background: var(--red); color: #fff; border-radius: 999px; font-size: 0.78rem; padding: 0.05rem 0.45rem; vertical-align: super; }

/* menu drawer */
.drawer-back { position: fixed; inset: 0; background: rgba(10,20,14,0.45); z-index: 40; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 88vw); background: #fff; z-index: 41;
  padding: 1rem; overflow-y: auto; box-shadow: 2px 0 18px rgba(0,0,0,0.25);
}
.drawer .identity { font-weight: 700; margin-bottom: 0.15rem; }
.drawer nav a, .drawer nav button.linklike {
  display: block; width: 100%; text-align: left; padding: 0.8rem 0.4rem; min-height: 48px;
  color: var(--ink); text-decoration: none; font-size: 1.02rem; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.drawer .foot { margin-top: 1.2rem; border-top: 2px solid var(--line); padding-top: 0.6rem; }

/* cards, buttons, forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0.8rem 0; }
.card.tap { cursor: pointer; }
.card.tap:active { background: var(--green-bg); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 48px; padding: 0.65rem 1.1rem; border-radius: 12px; border: 1px solid var(--green);
  background: var(--green); color: #fff; font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn.secondary { background: #fff; color: var(--green); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.block { display: flex; width: 100%; margin: 0.5rem 0; }
.btn.big { font-size: 1.15rem; min-height: 58px; }
.btn:disabled { opacity: 0.55; }
label { display: block; font-weight: 600; margin: 0.75rem 0 0.3rem; }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 0.6rem 0.7rem; font-size: 1rem;
  border: 1px solid #a9b8ad; border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid #9fd3b4; outline-offset: 1px; }
.pwrow { display: flex; gap: 0.5rem; align-items: stretch; }
.pwrow input { flex: 1; }
.pwrow button { min-width: 64px; border: 1px solid #a9b8ad; background: #fff; border-radius: 10px; cursor: pointer; font-size: 0.95rem; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 500; }
.check input { width: 26px; height: 26px; min-height: 26px; flex: none; margin-top: 0.15rem; }
.err { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 0.7rem 0.9rem; margin: 0.7rem 0; }
.ok { background: var(--green-bg); color: var(--green-dark); border-radius: 10px; padding: 0.7rem 0.9rem; margin: 0.7rem 0; }
.warn { background: var(--amber-bg); color: var(--amber); border-radius: 10px; padding: 0.7rem 0.9rem; margin: 0.7rem 0; }
.chip { display: inline-block; border-radius: 999px; padding: 0.14rem 0.65rem; font-size: 0.88rem; font-weight: 600; background: var(--green-bg); color: var(--green-dark); }
.chip.urgent { background: var(--red); color: #fff; }
.chip.stage { background: #e8edf5; color: #274b73; }
.chip.warnchip { background: var(--amber-bg); color: var(--amber); }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0; }
.chips button {
  min-height: 48px; padding: 0.55rem 0.95rem; border-radius: 999px; border: 1.5px solid #a9b8ad;
  background: #fff; font-size: 1rem; cursor: pointer;
}
.chips button.sel { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.chips button.danger.sel { background: var(--red); border-color: var(--red); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
@media (max-width: 430px) { .grid2 { grid-template-columns: 1fr; } }
.stat { text-align: left; }
.stat .num { font-size: 1.7rem; font-weight: 800; color: var(--green-dark); }
.stat .lbl { color: var(--muted); font-size: 0.95rem; }
.thread { margin: 0.6rem 0; }
.msg { border-radius: 12px; padding: 0.6rem 0.8rem; margin: 0.45rem 0; max-width: 92%; white-space: pre-wrap; word-break: break-word; }
.msg.company { background: var(--green-bg); margin-left: auto; }
.msg.tenant { background: #eef1ee; }
.msg.system { background: transparent; color: var(--muted); font-size: 0.92rem; text-align: center; max-width: 100%; }
.msg .when { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.photos { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0; }
.photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.safety {
  background: #fff8e6; border: 2.5px solid var(--red); border-radius: var(--radius); padding: 1rem; margin: 0.8rem 0;
}
.safety h2 { color: var(--red); margin-top: 0; }
.code-display { font-size: 2.2rem; font-weight: 800; letter-spacing: 0.25rem; text-align: center; padding: 0.8rem; background: var(--green-bg); border-radius: 12px; margin: 0.6rem 0; }
.progressline { display: flex; gap: 0.3rem; margin: 0.5rem 0; }
.progressline span { flex: 1; height: 8px; border-radius: 99px; background: #d5ddd6; }
.progressline span.hit { background: var(--green); }

/* report pill */
#report-pill {
  position: fixed; z-index: 35; right: 14px; bottom: 18px; display: flex; align-items: center; gap: 0.3rem;
  background: #fff; border: 1.5px solid var(--green); color: var(--green-dark); border-radius: 999px;
  padding: 0.55rem 0.9rem; min-height: 48px; font-size: 1rem; font-weight: 700; box-shadow: 0 3px 14px rgba(0,0,0,0.22); cursor: grab; touch-action: none;
}
#report-pill .x { font-weight: 400; color: var(--muted); padding: 0 0.2rem; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(10,20,14,0.5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 1.1rem 1.1rem 2rem; }
@media (min-width: 700px) { .modal-back { align-items: center; } .modal { border-radius: 18px; } }

/* toast */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 60;
  background: var(--ink); color: #fff; padding: 0.7rem 1.1rem; border-radius: 999px; font-size: 0.98rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3); max-width: 92vw; text-align: center;
}
.langrow { display: flex; gap: 0.5rem; align-items: center; justify-content: flex-end; padding: 0.6rem 0 0; }
.langrow select { width: auto; min-height: 44px; }
.footstamp { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 2rem; }
.banner { background: var(--green-bg); border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.9rem; margin: 0.8rem 0; display: flex; gap: 0.6rem; align-items: center; }
.banner button { margin-left: auto; }
select.inline { width: auto; }
.rowline { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.rowline > * { margin: 0; }
