/* PG Hostel SaaS — self-contained UI, no external fonts or CDNs.
   Layout targets three classes of device:
     ≥1025px  desktop  — permanent sidebar
     ≤1024px  tablet   — sidebar becomes a slide-in drawer over a scrim
     ≤720px   phone    — data tables render as stacked cards, dialogs as sheets
*/
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --green: #059669;  --green-soft: #ecfdf5;
  --amber: #b45309;  --amber-soft: #fffbeb;
  --red: #dc2626;    --red-soft: #fef2f2;
  --gray-soft: #f1f5f9;
  --sidebar: #0f172a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 16px rgba(15, 23, 42, .05);
}
/* Follows the device's light/dark setting; every colour is a variable so the
   whole UI switches without any per-component overrides. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --card: #16203400;
    --card: #172033;
    --ink: #e2e8f0;
    --muted: #94a3b8;
    --line: #2a3854;
    --accent: #818cf8;
    --accent-soft: #1e2a4a;
    --green: #34d399;  --green-soft: #10291f;
    --amber: #fbbf24;  --amber-soft: #2e2410;
    --red: #f87171;    --red-soft: #341a1a;
    --gray-soft: #1e293b;
    --sidebar: #070d1b;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  }
  input, select, textarea { background: var(--gray-soft); color: var(--ink); }
  .btn.secondary { background: var(--gray-soft); }
  .boot-splash, .auth-wrap { background: linear-gradient(160deg, #111a2e 0%, #0b1120 55%, #0d1f1a 100%); }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.45;
  overflow-x: hidden; /* nothing may push the page sideways */
}
body.no-scroll { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
h1, h2, h3 { margin: 0 0 .4em; }
a { color: var(--accent); text-decoration: none; }

/* ---------- boot / auth ---------- */
.boot-splash, .auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, #eef2ff 0%, #f1f5f9 55%, #ecfdf5 100%);
}
.auth-wrap {
  padding: 32px;
  background:
    radial-gradient(circle at 12% 15%, rgba(99, 102, 241, .18), transparent 32%),
    radial-gradient(circle at 88% 84%, rgba(16, 185, 129, .16), transparent 30%),
    linear-gradient(145deg, #eef2ff 0%, #f8fafc 52%, #ecfdf5 100%);
}
.boot-card, .auth-card {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  padding: 36px; width: 100%; max-width: 400px; text-align: center;
}
.auth-shell {
  position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
  width: min(1040px, 100%); min-height: 650px; overflow: hidden; border-radius: 28px;
  background: var(--card); border: 1px solid rgba(148, 163, 184, .18);
  box-shadow: 0 30px 80px rgba(15, 23, 42, .18);
}
.auth-showcase {
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column;
  justify-content: space-between; gap: 26px; padding: 42px 46px; color: #fff;
  background: linear-gradient(145deg, #111d4a 0%, #312e81 48%, #4f46e5 100%);
}
.auth-showcase::before, .auth-showcase::after {
  content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(1px);
}
.auth-showcase::before {
  width: 360px; height: 360px; right: -170px; top: -130px;
  background: radial-gradient(circle, rgba(129, 140, 248, .7), rgba(129, 140, 248, 0) 70%);
}
.auth-showcase::after {
  width: 340px; height: 340px; left: -170px; bottom: -180px;
  background: radial-gradient(circle, rgba(16, 185, 129, .42), rgba(16, 185, 129, 0) 70%);
}
.auth-home-link {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; color: #fff;
  border: 1px solid rgba(255,255,255,.24); background: rgba(255,255,255,.08);
  border-radius: 999px; padding: 8px 13px; font-size: 12.5px; font-weight: 700;
  backdrop-filter: blur(10px); transition: transform .18s ease, background .18s ease;
}
.auth-home-link:hover { background: rgba(255,255,255,.16); transform: translateX(-2px); }
.auth-home-link span { font-size: 17px; line-height: 1; }
.auth-showcase-copy { max-width: 460px; }
.auth-eyebrow, .auth-card-kicker {
  display: block; color: #a5b4fc; font-size: 11px; font-weight: 800; letter-spacing: .16em;
}
.auth-showcase-copy h1 {
  margin: 12px 0 14px; max-width: 430px; color: #fff; font-size: clamp(34px, 4.2vw, 52px);
  line-height: 1.02; letter-spacing: -.04em;
}
.auth-showcase-copy p { max-width: 450px; margin: 0; color: #dbeafe; font-size: 16px; line-height: 1.7; }
.auth-offer-card {
  position: relative; padding: 22px 24px; border: 1px solid rgba(255,255,255,.25); border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,.17), rgba(255,255,255,.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 18px 40px rgba(15,23,42,.18);
  backdrop-filter: blur(16px);
}
.auth-offer-badge {
  display: inline-flex; margin-bottom: 13px; padding: 5px 9px; border-radius: 999px;
  background: #fbbf24; color: #422006; font-size: 10px; font-weight: 900; letter-spacing: .11em;
}
.auth-trial-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.auth-trial-line strong { color: #fff; font-size: 22px; }
.auth-trial-line span { color: #dbeafe; font-size: 12.5px; }
.auth-plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.auth-plan-card {
  min-width: 0; padding: 11px 8px 10px; border: 1px solid rgba(255,255,255,.18); border-radius: 12px;
  background: rgba(15,23,42,.2); text-align: center;
}
.auth-plan-card.featured { border-color: #fbbf24; background: rgba(251,191,36,.13); }
.auth-plan-cap { display: block; color: #dbeafe; font-size: 11px; font-weight: 800; line-height: 1.25; }
.auth-plan-prices { display: grid; gap: 1px; margin-top: 6px; }
.auth-plan-old { color: #c7d2fe; font-size: 11px; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.auth-plan-prices strong { color: #fff; font-size: 20px; line-height: 1; letter-spacing: -.03em; white-space: nowrap; }
.auth-plan-period { color: #dbeafe; font-size: 10px; font-weight: 700; }
.auth-plan-loading { color: #dbeafe; font-size: 12px; }
.auth-price-line { display: flex; align-items: baseline; gap: 9px; margin: 8px 0 4px; }
.auth-old-price { color: #c7d2fe; font-size: 16px; text-decoration: line-through; text-decoration-thickness: 2px; }
.auth-price-line strong { color: #fff; font-size: 34px; line-height: 1; letter-spacing: -.03em; }
.auth-price-period { color: #dbeafe; font-weight: 700; }
.auth-offer-card p { margin: 9px 0 0; color: #dbeafe; font-size: 12.5px; }
.auth-contact { display: grid; gap: 8px; color: #c7d2fe; font-size: 12px; }
.auth-contact > span { font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.auth-contact-links { display: flex; flex-wrap: wrap; gap: 8px; }
.auth-contact-links a {
  color: #fff; border: 1px solid rgba(255,255,255,.18); background: rgba(15,23,42,.18);
  padding: 7px 10px; border-radius: 9px; font-size: 12px; font-weight: 700;
}
.auth-contact-links a:hover { background: rgba(255,255,255,.14); }
.auth-card {
  align-self: stretch; display: flex; flex-direction: column; justify-content: center;
  max-width: none; border-radius: 0; box-shadow: none; padding: 48px 46px; text-align: left;
}
.brand-mark { font-size: 42px; }
.auth-card .brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.auth-card .brand-row .brand-mark {
  display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px;
  border-radius: 15px; background: var(--accent-soft); font-size: 25px;
}
.auth-card .brand-row h2 { margin: 2px 0 0; font-size: 24px; letter-spacing: -.025em; }
.auth-card-kicker { color: var(--accent); font-size: 9.5px; }
.auth-card-intro { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tabs button {
  flex: 1; padding: 10px; border: 1px solid var(--line); background: var(--card); border-radius: 9px;
  cursor: pointer; font-weight: 600; color: var(--muted);
}
.auth-tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.auth-error { color: var(--red); background: var(--red-soft); border-radius: 8px; padding: 8px 12px; margin: 10px 0; font-size: 13px; }
.auth-notice { color: var(--green); background: var(--green-soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; }
.auth-plan { color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: 12.5px; font-weight: 600; }
.auth-required-note { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.auth-required-note span { color: var(--red); font-weight: 800; }
.auth-submit { width: 100%; justify-content: center; min-height: 44px; margin-top: 3px; }
.auth-reset-link {
  display: block; margin: 13px auto 0; border: 0; background: transparent;
  color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 700;
  cursor: pointer; text-decoration: underline;
}
.auth-reset-link:disabled { cursor: wait; opacity: .6; }

.sub-banner {
  display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); color: var(--ink);
  border-left: 4px solid var(--accent); border-radius: 10px; padding: 11px 15px; margin-bottom: 16px; font-size: 13.5px;
}
.sub-banner.urgent { background: var(--amber-soft); border-left-color: var(--amber); }
.auth-hint { color: var(--muted); font-size: 12.5px; margin-top: 14px; }
#google-btn { display: flex; justify-content: center; }
.auth-divider {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 4px;
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.phone-completion-wrap { padding: 24px; }
.phone-completion-card {
  width: min(460px, 100%); padding: 38px; border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 24px; background: var(--card); box-shadow: 0 28px 70px rgba(15, 23, 42, .18);
}
.phone-completion-icon {
  display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 18px;
  border-radius: 16px; background: var(--green-soft); color: var(--green); font-size: 25px; font-weight: 900;
}
.phone-completion-card h1 { margin: 7px 0 8px; font-size: 30px; letter-spacing: -.03em; }
.phone-completion-intro { margin: 0 0 18px; color: var(--muted); line-height: 1.6; }
.phone-completion-account {
  display: flex; flex-direction: column; gap: 2px; margin-bottom: 20px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--gray-soft);
}
.phone-completion-account span { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.phone-completion-card .auth-error { margin: 0 0 14px; }
.phone-completion-signout {
  display: block; margin: 14px auto 0; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline;
}
.phone-completion-signout:hover { color: var(--ink); }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; background: var(--sidebar); color: #cbd5e1; padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar .brand {
  color: #fff; font-weight: 700; font-size: 16px; padding: 6px 10px 16px; display: flex; gap: 8px; align-items: center;
}
.drawer-close { display: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar a.nav-item {
  display: flex; gap: 10px; align-items: center; color: #cbd5e1; padding: 9px 10px;
  border-radius: 8px; font-weight: 500;
}
.sidebar a.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.nav-item.active { background: var(--accent); color: #fff; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff; border-radius: 99px;
  padding: 0 7px; font-size: 11px; font-weight: 700; line-height: 18px; min-width: 18px; text-align: center;
}
.sidebar .whoami { border-top: 1px solid rgba(255,255,255,.12); padding: 12px 10px 4px; font-size: 12.5px; }
.sidebar .whoami .name { color: #fff; font-weight: 600; }
.sidebar .whoami .role-chip {
  display: inline-block; background: rgba(255,255,255,.14); color: #e2e8f0; padding: 1px 8px;
  border-radius: 99px; font-size: 11px; margin-top: 4px; text-transform: capitalize;
}
.sidebar .logout-btn {
  margin-top: 8px; width: 100%; background: transparent; color: #94a3b8; border: 1px solid rgba(255,255,255,.18);
  padding: 7px; border-radius: 8px; cursor: pointer;
}
.sidebar .logout-btn:hover { color: #fff; border-color: #fff; }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.topbar { display: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 21px; }
.page-head .sub { color: var(--muted); font-size: 13px; }

/* ---------- components ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }
.pg-card-cover { display: block; width: calc(100% + 40px); height: 155px; object-fit: cover; margin: -18px -20px 14px; border-radius: var(--radius) var(--radius) 0 0; }
.pg-listing-card { display: flex; flex-direction: column; min-height: 270px; transition: transform .18s ease, box-shadow .18s ease; }
.pg-listing-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(15, 23, 42, .12); }
.pg-card-availability { display: flex; justify-content: space-between; gap: 8px; margin-top: auto; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.pg-card-availability span:first-child { color: var(--green); font-weight: 800; }
.pg-card-cta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--accent); font-size: 12.5px; font-weight: 800; }
.pg-card-cta span { font-size: 17px; line-height: 1; }
.pg-back-link { display: inline-flex; margin-bottom: 12px; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.pg-back-link:hover { color: var(--accent); }
.pg-property-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); overflow: hidden; margin-bottom: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.pg-property-gallery { position: relative; display: grid; grid-template-columns: 1.45fr 1fr; min-height: 350px; background: var(--gray-soft); }
.pg-property-gallery.is-empty { display: block; }
.pg-property-gallery img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pg-property-primary-photo { grid-row: 1; }
.pg-property-photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border-left: 3px solid var(--card); }
.pg-property-photo-grid img { min-height: 0; border-bottom: 3px solid var(--card); }
.pg-property-photo-grid img:nth-last-child(-n + 2) { border-bottom: 0; }
.pg-property-photo-count { position: absolute; right: 14px; bottom: 14px; padding: 7px 10px; border-radius: 999px; background: rgba(15,23,42,.82); color: #fff; font-size: 12px; font-weight: 800; }
.pg-property-photo-placeholder { display: flex; min-height: 350px; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 28px; color: #fff; background: linear-gradient(145deg, #172554, #4338ca 55%, #0f766e); }
.pg-property-photo-placeholder span { color: #c7d2fe; font-size: 11px; font-weight: 900; letter-spacing: .16em; }
.pg-property-photo-placeholder strong { font-size: 25px; }
.pg-property-photo-placeholder small { color: #e0e7ff; font-size: 13px; }
.pg-property-summary { display: flex; flex-direction: column; padding: 30px; }
.pg-property-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 13px; }
.pg-property-summary h1 { margin: 0; color: var(--ink); font-size: clamp(25px, 3vw, 36px); letter-spacing: -.035em; line-height: 1.08; }
.pg-property-address { margin: 10px 0 20px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.pg-property-price { display: grid; gap: 2px; padding: 15px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pg-property-price span, .pg-property-price small { color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pg-property-price strong { color: var(--accent); font-size: 21px; letter-spacing: -.02em; }
.pg-property-price small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.pg-property-quick-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 16px 0; }
.pg-property-quick-facts div { display: grid; gap: 2px; min-width: 0; }
.pg-property-quick-facts strong { color: var(--ink); font-size: 19px; }
.pg-property-quick-facts span { color: var(--muted); font-size: 11px; line-height: 1.25; }
.pg-property-section { margin-bottom: 22px; }
.pg-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 0 0 12px; }
.pg-section-heading h2 { margin: 2px 0 0; font-size: 20px; letter-spacing: -.02em; }
.pg-section-heading p { max-width: 410px; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; text-align: right; }
.pg-section-kicker { display: block; color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.pg-room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; }
.pg-room-card { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.pg-room-card.has-vacancy { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.pg-room-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pg-room-card-top span:first-child { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.pg-room-card-top h3 { margin: 3px 0 0; font-size: 18px; }
.pg-room-status { flex: 0 0 auto; padding: 4px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 800; }
.pg-room-status.open { background: var(--green-soft); color: var(--green); }
.pg-room-status.full { background: var(--gray-soft); color: var(--muted); }
.pg-room-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.pg-room-meta span { padding: 3px 7px; border-radius: 6px; background: var(--gray-soft); color: var(--muted); font-size: 11.5px; }
.pg-room-rent { display: block; margin-bottom: 12px; color: var(--ink); font-size: 17px; }
.pg-room-rent small { color: var(--muted); font-size: 11.5px; font-weight: 500; }
.pg-room-bed-list { display: flex; flex-wrap: wrap; margin: -2px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pg-room-counts { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.pg-room-counts span:first-child { color: var(--green); font-weight: 800; }
.grid { display: grid; gap: 14px; }
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 18px; }
.tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.tile .t-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.tile .t-value { font-size: 22px; font-weight: 700; margin-top: 2px; }
.tile .t-value.pos { color: var(--green); }
.tile .t-value.neg { color: var(--red); }
.tile .t-value.warn { color: var(--amber); }
.tile .t-sub { color: var(--muted); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border: none;
  padding: 8px 15px; border-radius: 8px; font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--red); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--accent-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; text-transform: capitalize; white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.indigo { background: var(--accent-soft); color: var(--accent); }
.badge.gray { background: var(--gray-soft); color: var(--muted); }

.bed-chip {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 9px; margin: 2px; font-size: 12.5px; font-weight: 600; cursor: pointer; background: #fff;
}
.bed-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.bed-chip.vacant .dot { background: var(--green); }
.bed-chip.occupied .dot { background: var(--accent); }
.bed-chip.reserved .dot { background: #d97706; }
.bed-chip.maintenance .dot { background: #94a3b8; }
.bed-chip.occupied { cursor: default; background: var(--accent-soft); border-color: var(--accent-soft); }

.occ-bar { background: var(--line); border-radius: 99px; height: 8px; overflow: hidden; }
.occ-bar > div { height: 100%; background: var(--accent); border-radius: 99px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: flex-end; }
.filters .f { display: flex; flex-direction: column; gap: 3px; }
.filters label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tenant-search-filter { min-width: min(280px, 100%); flex: 1 1 220px; }

form .frm { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
form .frm label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
form .frm .hint { font-size: 11.5px; color: var(--muted); }
.pg-field-validation { display: flex; justify-content: space-between; gap: 8px; min-height: 16px; font-size: 11.5px; line-height: 1.35; }
.pg-field-error { color: var(--red); font-weight: 600; }
.pg-character-count { margin-left: auto; color: var(--muted); white-space: nowrap; }
.pg-input-invalid { border-color: var(--red); background: #fff7f7; }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  width: 100%; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.frm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pg-form-intro { margin: -3px 0 16px; padding: 10px 12px; border: 1px solid var(--accent-soft); border-radius: 8px; background: var(--accent-soft); color: #3730a3; font-size: 12.5px; line-height: 1.45; }
.pg-amenity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pg-amenity-grid label { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 12.5px; font-weight: 500; }
.pg-amenity-grid input { width: auto; margin: 0; }
.pg-photo-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 2px 0 10px; }
.pg-photo-item { position: relative; min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--gray-soft); }
.pg-photo-item img { display: block; width: 100%; height: 74px; object-fit: cover; }
.pg-photo-item span { display: block; padding: 4px 5px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.pg-new-photo { aspect-ratio: 1; cursor: grab; }
.pg-new-photo img { width: 100%; height: 100%; }
.pg-new-photo.is-primary { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pg-new-photo.is-dragging { opacity: .55; cursor: grabbing; }
.pg-new-photo.is-drop-target { outline: 3px solid var(--accent); outline-offset: -3px; }
.pg-photo-badge { position: absolute; top: 5px; left: 5px; right: 32px; border-radius: 999px; padding: 3px 5px; background: rgba(15,23,42,.82); color: #fff; font-size: 9px; font-weight: 700; line-height: 1.15; text-align: center; }
.pg-photo-drag-hint { position: absolute; right: 5px; bottom: 5px; left: 5px; border-radius: 5px; padding: 3px 4px; background: rgba(255,255,255,.92); color: var(--ink); font-size: 8.5px; font-weight: 700; line-height: 1.2; text-align: center; pointer-events: none; }
.pg-photo-remove { position: absolute; top: 4px; right: 4px; width: 23px; height: 23px; border: 0; border-radius: 50%; background: rgba(15,23,42,.78); color: #fff; cursor: pointer; font-size: 18px; line-height: 20px; }
.pg-photo-remove:hover { background: var(--red); }
.pg-photo-upload-error { min-height: 16px; margin-top: 4px; color: var(--red); font-size: 11.5px; font-weight: 600; }
.pg-photo-empty { margin: 2px 0 10px; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 12px; text-align: center; }
.pg-detail-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pg-detail-gallery img { display: block; width: 100%; height: 105px; border-radius: 8px; object-fit: cover; }
.pg-detail-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.pg-detail-list div { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--gray-soft); }
.pg-detail-list span, .pg-detail-list strong { display: block; }
.pg-detail-list span { margin-bottom: 2px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.pg-detail-list strong { color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.pg-description { margin: 14px 0 0; color: var(--ink); font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.pg-description.pg-muted { color: var(--muted); font-style: italic; }
.pg-amenity-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pg-amenity-tags span { padding: 4px 8px; border-radius: 99px; background: var(--accent-soft); color: #3730a3; font-size: 11.5px; font-weight: 600; }
.pg-rules { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.pg-rules strong { font-size: 12.5px; }
.pg-rules p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; }

.empty { color: var(--muted); text-align: center; padding: 26px 10px; }

/* ---------- notifications ---------- */
.alert-row {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 6px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.alert-row:last-child { border-bottom: none; }
.alert-row:hover { background: var(--gray-soft); }
.alert-row.unread { background: var(--accent-soft); }
.alert-row.unread:hover { background: #e0e7ff; }
.alert-icon { font-size: 18px; line-height: 1.2; }
.alert-title { font-weight: 600; }
.alert-body { color: var(--muted); font-size: 13px; margin-top: 1px; }
.alert-time { color: var(--muted); font-size: 11.5px; margin-top: 3px; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center;
  justify-content: center; padding: 18px; z-index: 50;
}
.modal {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 460px;
  max-height: 92vh; overflow-y: auto; padding: 22px 24px;
}
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow);
  font-size: 13.5px; max-width: 340px; animation: toast-in .18s ease-out;
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .auth-wrap { align-items: flex-start; padding: 18px; }
  .auth-shell { grid-template-columns: 1fr; max-width: 620px; border-radius: 22px; }
  .auth-showcase { gap: 20px; padding: 28px 30px; }
  .auth-showcase-copy h1 { max-width: 500px; font-size: 38px; }
  .auth-showcase-copy p { font-size: 14px; }
  .auth-offer-card { padding: 18px 20px; }
  .auth-card { padding: 36px 30px 40px; }
}

/* Very wide screens: keep line lengths readable instead of stretching forever. */
@media (min-width: 1600px) {
  .main > * { max-width: 1500px; margin-left: auto; margin-right: auto; }
}

/* Tablet and below: the sidebar becomes a drawer above a scrim. */
@media (max-width: 1024px) {
  .topbar {
    display: flex; align-items: center; gap: 12px; background: var(--sidebar);
    color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 46;
    padding-top: calc(10px + env(safe-area-inset-top));
  }
  .topbar .brand { font-weight: 700; display: flex; gap: 8px; align-items: center; flex: 1; }
  .topbar .menu-btn, .topbar .topbar-bell {
    background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 10px;
    min-width: 42px; height: 42px; font-size: 17px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; position: relative; text-decoration: none;
  }
  .shell { flex-direction: column; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: 286px; max-width: 88vw;
    transform: translateX(-100%); transition: transform .22s ease-out; z-index: 48;
    overflow-y: auto; display: flex; padding-top: calc(18px + env(safe-area-inset-top));
  }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .scrim { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 47; }
  .main { padding: 18px 16px 64px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .pg-property-hero { grid-template-columns: 1fr; }
  .pg-property-gallery { min-height: 300px; }
}
@media (min-width: 1025px) { .scrim { display: none !important; } }

/* Phone: stack forms, shrink chrome, and give touch-sized controls. */
@media (max-width: 720px) {
  .phone-completion-wrap { align-items: flex-start; padding: 14px; }
  .phone-completion-card { padding: 28px 20px; border-radius: 18px; }
  .auth-wrap { padding: 0; background: var(--card); }
  .auth-shell { min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .auth-showcase { padding: 24px 20px 26px; }
  .auth-showcase-copy h1 { margin: 10px 0; font-size: 32px; }
  .auth-showcase-copy p { line-height: 1.55; }
  .auth-price-line strong { font-size: 30px; }
  .auth-plan-grid { grid-template-columns: 1fr; gap: 7px; }
  .auth-plan-card { display: grid; grid-template-columns: 1fr auto 58px; align-items: center; text-align: left; padding: 10px 12px; }
  .auth-plan-prices { margin: 0; text-align: right; }
  .auth-plan-period { text-align: right; }
  .auth-contact-links { flex-direction: column; align-items: flex-start; }
  .auth-card { padding: 32px 20px 44px; }
  .main { padding: 14px 12px 68px; }
  /* Two compact columns keep all destinations visible without a long menu.
     Every item stays above the recommended 44px touch target. */
  .sidebar { width: min(336px, 88vw); padding: 12px 10px calc(12px + env(safe-area-inset-bottom)); gap: 8px; }
  .sidebar-header { padding: 0 2px 6px; border-bottom: 1px solid rgba(255,255,255,.12); }
  .sidebar .brand { padding: 6px 4px; font-size: 15px; }
  .drawer-close { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: 1px solid rgba(255,255,255,.28); border-radius: 10px; background: transparent; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
  .sidebar nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; flex: 0; }
  .sidebar a.nav-item { min-height: 52px; gap: 7px; padding: 8px; border: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.035); font-size: 12px; line-height: 1.2; }
  .sidebar a.nav-item > span:first-child { flex: 0 0 auto; font-size: 16px; }
  .sidebar a.nav-item.active { border-color: rgba(255,255,255,.32); }
  .sidebar .whoami { margin-top: 4px; padding: 10px 6px 2px; font-size: 12px; }
  .sidebar .logout-btn { min-height: 42px; font-size: 14px; }
  .card { padding: 14px 14px; border-radius: 10px; }
  /* Title on its own line, actions full width beneath it — squeezing a button
     beside the heading wrapped its label onto three lines. */
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 14px; }
  .page-head h2 { font-size: 19px; }
  /* :not(:first-child) so a page-head with only a title block is untouched —
     otherwise the title itself becomes a row and the subtitle sits beside it. */
  .page-head > div:last-child:not(:first-child) { display: flex; gap: 8px; }
  .page-head .btn { flex: 1; justify-content: center; white-space: nowrap; }
  .pg-property-gallery { min-height: 250px; grid-template-columns: 1.3fr 1fr; }
  .pg-property-summary { padding: 20px 16px; }
  .pg-section-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .pg-section-heading p { text-align: left; }
  .pg-room-grid { grid-template-columns: 1fr; }
  .frm-row { grid-template-columns: 1fr; }
  .pg-amenity-grid { grid-template-columns: 1fr 1fr; }
  .pg-photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px; }
  .tile .t-value { font-size: 19px; }
  .filters { gap: 8px; }
  .filters .f { flex: 1 1 46%; min-width: 0; }
  /* 16px prevents iOS from zooming the page when a field takes focus. */
  input, select, textarea { font-size: 16px; padding: 10px 12px; }
  .btn { padding: 10px 15px; min-height: 42px; }
  .btn.small { padding: 7px 11px; min-height: 34px; }

  /* Dialogs become bottom sheets — reachable with a thumb. */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    animation: sheet-up .2s ease-out;
  }
  .modal-actions .btn { flex: 1; justify-content: center; }
  #toast-root { right: 12px; left: 12px; bottom: 12px; }
  .toast { max-width: none; }

  /* List tables become record cards. The JS copies each column heading to
     data-label, so this works consistently for tenants, rooms, invoices,
     billing, expenses, complaints, reports, and admin tables. */
  table.data.has-table-header, table.data.has-table-header tbody,
  table.data.has-table-header tr, table.data.has-table-header td { width: 100%; }
  table.data.has-table-header { display: block; border-collapse: separate; border-spacing: 0; }
  table.data.has-table-header tbody { display: block; }
  table.data.has-table-header tr:first-child { display: none; }
  table.data.has-table-header tr {
    display: flex; flex-direction: column; border: 1px solid var(--line);
    border-radius: 15px; margin-bottom: 12px; padding: 7px 14px;
    background: var(--card); box-shadow: 0 3px 12px rgba(15, 23, 42, .045);
    overflow: hidden;
  }
  table.data.has-table-header tr:last-child { margin-bottom: 0; }
  table.data.has-table-header tr.clickable { border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); }
  table.data.has-table-header tr.clickable:active { transform: scale(.992); background: var(--accent-soft); }
  table.data.has-table-header tr.clickable:hover td { background: transparent; }
  table.data.has-table-header td {
    display: flex; min-width: 0; align-items: flex-start; justify-content: space-between;
    gap: 14px; border: none; border-bottom: 1px solid var(--line); padding: 9px 0;
    text-align: right; overflow-wrap: anywhere;
  }
  table.data.has-table-header tr td:last-child { border-bottom: none; }
  table.data.has-table-header td[data-label]::before {
    content: attr(data-label); width: 38%; flex: 0 0 38%; font-size: 10.5px;
    font-weight: 800; letter-spacing: .06em; line-height: 1.45; text-transform: uppercase;
    color: var(--muted); text-align: left;
  }
  table.data.has-table-header td.mobile-record-title {
    order: -1; align-items: center; min-height: 28px; padding: 7px 0 10px;
    color: var(--ink); font-size: 15px; font-weight: 700; text-align: left;
  }
  table.data.has-table-header td.mobile-record-title::before { display: none; }
  table.data.has-table-header td[colspan] { display: block; text-align: center; }
  table.data.has-table-header td.actions-cell {
    justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 12px;
  }
  table.data.has-table-header td.actions-cell .btn { min-height: 36px; }
  /* Invoice, settlement and plan detail tables have no header row. Keep all
     their rows visible and readable instead of converting them to list cards. */
  table.data.is-detail-table td { padding: 9px 8px; }
  table.data.is-detail-table td:first-child { width: 42%; color: var(--muted); font-weight: 700; }
  .table-wrap { overflow-x: visible; }
}

@keyframes sheet-up { from { transform: translateY(12px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Coarse pointers (touch) get larger hit areas regardless of screen size. */
@media (pointer: coarse) {
  .nav-item { padding: 12px 10px; }
  .bed-chip { padding: 8px 12px; }
  .alert-row { padding: 14px 6px; }
}

.auth-note {
  background: var(--amber-soft); color: var(--amber); border-radius: 8px;
  padding: 9px 12px; margin-bottom: 12px; font-size: 12.5px; line-height: 1.4;
}
