/* Nexy One — tenant portal. Uses tokens from nexy-one.css. */
html { background: var(--canvas); }
.tp-form [hidden], [hidden] { display: none !important; }
body.portal { margin: 0; min-height: 100vh; padding-bottom: 96px; }
.tp-form { display: flex; flex-direction: column; gap: 12px; }
body.portal:has(.auth) { padding-bottom: 0; }
.portal a { color: var(--cedar-700); }
.wrap { max-width: 860px; margin: 0 auto; padding: 28px 18px; }
.brand-orb { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; overflow: hidden; flex: none; background: var(--brand-grad); color: var(--action-ink); font-weight: 800; }
.brand-orb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.tp-choose { margin-bottom: 12px; }

/* Top bar */
.topbar { position: sticky; top: 10px; z-index: 20; display: flex; align-items: center; gap: 16px; height: 62px; padding: 0 18px; margin: 10px 10px 0; background: var(--paper) !important; color: var(--ink); border: 1px solid var(--line) !important; border-radius: var(--r-lg) !important; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--edge-hi), var(--shadow-float); }
.tb-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; }
.tb-brand span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-nav { display: flex; gap: 2px; margin-left: auto; }
.tb-nav a { padding: 8px 12px; border-radius: 12px; color: var(--ink-2) !important; font-weight: 600; font-size: 14px; text-decoration: none; }
.tb-nav a i { margin-right: 6px; opacity: .8; }
.tb-nav a:hover { color: var(--ink) !important; background: var(--hover); }
.tb-nav a.on { color: var(--ink) !important; background: var(--brand-grad-soft); }
.topbar .nx-icon-btn { background: transparent !important; border-color: var(--line) !important; color: var(--ink-2) !important; }

.hello { font-size: 28px; font-weight: 750; letter-spacing: -0.03em; margin: 4px 0 2px; }
.page-h { font-size: 26px; font-weight: 750; letter-spacing: -0.03em; margin: 4px 0 20px; }

/* Balance — the main thing on the home tab */
.balance { position: relative; overflow: hidden; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 26px !important; margin: 20px 0; background: linear-gradient(135deg, rgba(45,212,191,.18), rgba(109,124,255,.18)), var(--paper) !important; color: var(--ink-2); }
.balance > div { display: flex; flex-direction: column; gap: 4px; }
.balance .nx-muted { color: var(--muted) !important; }
.balance strong { font-size: clamp(34px, 7vw, 46px); font-weight: 750; letter-spacing: -0.035em; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.balance strong.paid { color: var(--ok); }
.balance .nx-small { color: var(--ink-2); }
.balance .tp-late { color: var(--bad); }
.balance .pay-btn { background: var(--brand-grad) !important; border-color: transparent !important; color: var(--action-ink) !important; }
.balance .pay-btn:hover { background: var(--action-hover) !important; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.quick a { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 16px !important; color: var(--ink) !important; font-weight: 650; font-size: 14px; text-decoration: none; }
.quick a:hover { border-color: var(--line-2) !important; }
.quick a i { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--teal); font-size: 15px; }
.nx-card + .nx-card, section + section.nx-card { margin-top: 16px; }
.nx-card-title { margin-bottom: 8px !important; }
.bill, .pm-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; color: var(--ink) !important; text-decoration: none; }
.nx-card-title + .bill, .nx-card-title + .pm-row, .nx-card > .bill:first-child { border-top: 0; }
.bill > div:first-child, .pm-row { display: flex; flex-direction: column; }
.pm-row { align-items: flex-start; }
.bill strong { font-weight: 650; }
.bill-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.tp-wa { background: #1fa855 !important; border-color: #1fa855 !important; color: #fff !important; }
.nx-dl { margin-bottom: 18px; }

/* Bottom tabs (phones) */
.bottom-nav { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 30; display: none; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--pop) !important; border: 1px solid var(--line-2) !important; border-radius: 20px !important; box-shadow: var(--shadow-pop); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 11px; font-weight: 650; color: var(--muted) !important; text-decoration: none; }
.bottom-nav a i { font-size: 18px; }
.bottom-nav a.on { color: var(--ink) !important; background: var(--brand-grad-soft); border-radius: 14px; }
.bottom-nav a.on i { color: var(--teal); }

/* M-Pesa sheet */
.sheet { position: fixed; inset: 0; z-index: 50; display: none; align-items: flex-end; justify-content: center; background: rgba(7, 26, 23, .55); }
.sheet.open { display: flex; }
.sheet-card { position: relative; width: 100%; max-width: 460px; padding: 26px 22px calc(26px + env(safe-area-inset-bottom)); border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--pop); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow-pop); animation: n1-rise .2s var(--ease); }
.sheet-card h3 { margin: 0 0 4px; font-size: 20px; }
.sheet-card .nx-stack { margin-top: 18px; }
.sheet-x { position: absolute; top: 14px; right: 14px; }
.pay-wait { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r-md); background: var(--hover); font-weight: 600; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--cedar-100); border-top-color: var(--cedar-700); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (min-width: 640px) { .sheet { align-items: center; } .sheet-card { border-radius: var(--r-lg); } }
@media (max-width: 760px) {
  .tb-nav { display: none; }
  .bottom-nav { display: grid; }
  .topbar { padding: 0 16px; }
  .topbar .nx-icon-btn { margin-left: auto; }
  .quick { grid-template-columns: repeat(2, 1fr); }
  .balance .pay-btn { width: 100%; }
}

.topbar .tp-theme { margin-left: 8px; margin-right: 4px; border: 0; cursor: pointer; }
.tp-theme .fa-moon, [data-theme="light"] .tp-theme .fa-sun { display: none; }
[data-theme="light"] .tp-theme .fa-moon { display: inline; }
.topbar .tp-theme + .nx-icon-btn { margin-left: 0; }
@media (max-width: 760px) { .topbar .tp-theme { margin-left: auto; } }

/* Login: choose how the code is sent (WhatsApp / SMS) */
.tp-chan-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tp-chan-opt { position: relative; display: flex; cursor: pointer; margin: 0; }
.tp-chan-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.tp-chan-opt span { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 10px;
  border: 1px solid var(--line, rgba(255,255,255,.14)); border-radius: 12px; font-weight: 650; color: var(--ink, #eef2ff);
  background: var(--field, rgba(255,255,255,.06)); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.tp-chan-opt input:checked + span { border-color: transparent; background: var(--brand-grad, linear-gradient(135deg,#2dd4bf,#6d7cff)); color: var(--on-grad, #051a17); }
.tp-chan-opt input:focus-visible + span { outline: 3px solid var(--teal, #2dd4bf); outline-offset: 2px; }
.tp-chan-opt .fa-whatsapp { color: #25D366; }
.tp-chan-opt input:checked + span .fa-whatsapp { color: inherit; }
