/* ============================================================
   PangoPoa — styles.css
   Mobile-first (~375px), warm orange + teal, trustworthy feel.
   ============================================================ */
:root {
  --orange: #E8641B;
  --orange-dark: #C24F10;
  --orange-soft: #FDEDE2;
  --teal: #0E7C7B;
  --teal-dark: #0A5F5E;
  --teal-soft: #E2F3F3;
  --gold: #B8860B;
  --gold-soft: #FCF3D9;
  --ink: #26221E;
  --ink-soft: #6B635B;
  --bg: #FAF6F1;
  --card: #FFFFFF;
  --line: #EADFD4;
  --danger: #C0392B;
  --danger-soft: #FDEBE8;
  --ok: #1E8449;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(60, 40, 20, 0.08);
  --nav-h: 64px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  padding-bottom: calc(var(--nav-h) + 16px);
}

img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--orange);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.2px;
}

.brand svg { flex: 0 0 auto; }
.brand .brand-poa { color: #FFE0B8; }

.lang-pills {
  display: flex;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 3px;
}

.lang-pill {
  border: 0;
  background: transparent;
  color: #FFE9D6;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  min-height: 32px;
}

.lang-pill.active { background: #fff; color: var(--orange-dark); }

/* ---------- Layout ---------- */
main#view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.page-title { font-size: 24px; margin: 6px 0 2px; }
.section-title { font-size: 18px; margin: 22px 0 10px; }
.tagline { color: var(--ink-soft); margin: 0 0 14px; font-size: 14px; }

/* ---------- Filter bar ---------- */
.filter-bar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.filter-row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.filter-row:last-child { margin-bottom: 0; }

.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 140px; }
.field > span { font-size: 12px; font-weight: 700; color: var(--ink-soft); }

.field input,
.field select,
.field textarea {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  min-height: 48px;
  background: #fff;
  width: 100%;
}

.field textarea { min-height: 96px; resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232, 100, 27, 0.15);
}

.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline > span { white-space: nowrap; }
.field-inline select { min-height: 44px; padding: 8px 10px; }

.filter-toggles { gap: 8px; }

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  min-height: 48px;
  flex: 1 1 150px;
  font-size: 14px;
  font-weight: 600;
  user-select: none;
}

.toggle input { width: 22px; height: 22px; accent-color: var(--orange); flex: 0 0 auto; }

.filter-sort { align-items: center; justify-content: space-between; }
.results-count { font-weight: 700; color: var(--teal-dark); font-size: 14px; }

/* ---------- Cards grid ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 640px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card:active { transform: scale(0.985); }
@media (hover: hover) {
  .card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(60, 40, 20, 0.14); }
}

.card-premium { border: 2px solid var(--gold); }

.card-photo { position: relative; aspect-ratio: 16 / 10; background: #DDEDF4; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }

.card-badges {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 60px);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge svg { width: 12px; height: 12px; }
.badge-verified { background: var(--teal); color: #fff; }
.badge-premium { background: var(--gold); color: #fff; }
.badge-pending { background: #E9E2D6; color: #7A6A4F; }

.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.fav-btn.active { color: #E0245E; }

.card-body { padding: 12px 14px 14px; }

.card-price { font-size: 20px; font-weight: 800; color: var(--orange-dark); }
.per-month { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-left: 2px; }
.card-meta { font-size: 13px; color: var(--teal-dark); font-weight: 700; margin: 2px 0; }
.card-title { font-size: 14px; color: var(--ink-soft); }

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  background: var(--card);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
}

.empty-state .btn { margin-top: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 13px 18px;
  font-weight: 800;
  font-size: 15px;
  min-height: 48px;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--line);
}

.btn-primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-primary:active { background: var(--orange-dark); }
.btn-teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-gold { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.btn-whatsapp { background: #25D366; border-color: #25D366; color: #fff; }
.btn-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-block { display: flex; width: 100%; }
.btn-small { padding: 8px 12px; min-height: 40px; font-size: 13px; border-radius: 10px; }
.btn-lang { flex: 1; }
.btn-lang.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-report { color: var(--danger); margin-top: 14px; }

.btn-back {
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  font-weight: 800;
  font-size: 15px;
  padding: 10px 4px;
  min-height: 44px;
}

/* ---------- Detail ---------- */
.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.fav-btn-detail { position: static; box-shadow: none; border: 1.5px solid var(--line); }

.detail-photos {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-radius: var(--radius);
  scroll-snap-type: x mandatory;
}

.detail-photo {
  width: 100%;
  flex: 0 0 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius);
  scroll-snap-align: start;
}

.detail-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.detail-badges .badge { font-size: 12px; padding: 5px 10px; }

.detail-title { font-size: 22px; margin: 8px 0 2px; }
.detail-price { font-size: 26px; font-weight: 800; color: var(--orange-dark); }
.detail-meta { color: var(--teal-dark); font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.detail-desc { white-space: pre-line; }

/* ---------- Panels ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
  box-shadow: var(--shadow);
}

.panel h3 {
  margin: 0 0 8px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel p { margin: 6px 0; font-size: 14.5px; }

.panel-verified { background: var(--teal-soft); border-color: var(--teal); }
.panel-verified h3 { color: var(--teal-dark); }
.panel-warning { background: #FFF7E0; border-color: #E3C56B; }
.panel-warning h3 { color: #8A6D1B; }
.panel-locked { background: var(--orange-soft); border-color: var(--orange); text-align: center; }
.panel-locked .lock-icon { color: var(--orange-dark); margin-bottom: 4px; }
.panel-contact { border-color: var(--teal); }
.panel-link { cursor: pointer; }
.panel-link h3 { color: var(--teal-dark); margin: 0; }

.contact-name { font-size: 15px; }
.contact-phone { font-size: 22px; font-weight: 800; letter-spacing: 0.5px; }
.contact-actions { display: flex; gap: 10px; margin-top: 8px; }
.contact-actions .btn { flex: 1; }

/* ---------- Feature list ---------- */
.feat-list, .verif-list { list-style: none; margin: 0; padding: 0; }

.feat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
}

.feat:last-child { border-bottom: 0; }
.feat-icon { color: var(--teal); display: flex; }
.feat-label { flex: 1; font-weight: 600; }
.feat-val { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 13px; }
.feat-yes .feat-val { color: var(--ok); }
.feat-no .feat-val { color: var(--ink-soft); }
.feat-no .feat-icon { color: var(--ink-soft); opacity: 0.5; }

.verif-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--teal-dark);
}

.prem-benefits li { color: var(--gold); }

/* ---------- Landlord dashboard ---------- */
.my-listings { display: flex; flex-direction: column; gap: 12px; }

.my-listing {
  display: flex;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.my-thumb {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 10px;
  flex: 0 0 auto;
}

.my-body { flex: 1; min-width: 0; }
.my-title { font-weight: 800; font-size: 15px; cursor: pointer; color: var(--teal-dark); }
.my-meta { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.my-views { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--orange-dark); }
.my-badges { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.prem-note { color: var(--gold); font-weight: 700; }
.my-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Listing form ---------- */
.listing-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.listing-form .field { margin-bottom: 12px; }
.listing-form .filter-row .field { margin-bottom: 0; }
.listing-form .filter-row { margin-bottom: 12px; }
.check-group { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
@media (min-width: 640px) { .check-group { grid-template-columns: 1fr 1fr; } }
.hint { color: var(--ink-soft); font-size: 12.5px; font-weight: 500; }
.form-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

.photo-thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.photo-thumb { position: relative; width: 92px; height: 92px; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; border: 1.5px solid var(--line); }
.photo-x {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: var(--danger);
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

input[type="file"] { padding: 10px; border: 1.5px dashed var(--line); border-radius: 10px; background: var(--bg); width: 100%; }

/* ---------- Account ---------- */
.lang-row { display: flex; gap: 10px; }
.status-ok { color: var(--ok); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.data-actions { display: flex; flex-direction: column; gap: 10px; }
.import-label { position: relative; }
.version-note { text-align: center; color: var(--ink-soft); font-size: 12.5px; margin-top: 20px; }

/* ---------- How it works ---------- */
.compare { display: flex; gap: 12px; margin: 14px 0; }
.compare-col {
  flex: 1;
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
}
.compare-bad { background: var(--danger-soft); border: 1.5px solid var(--danger); }
.compare-good { background: var(--teal-soft); border: 1.5px solid var(--teal); }
.compare-name { font-weight: 800; font-size: 15px; }
.compare-bad .compare-name { color: var(--danger); }
.compare-good .compare-name { color: var(--teal-dark); }
.compare-price { font-size: 22px; font-weight: 800; margin: 6px 0; }
.compare-bad .compare-price { color: var(--danger); text-decoration: line-through; }
.compare-good .compare-price { color: var(--teal-dark); }
.compare-col p { font-size: 12.5px; color: var(--ink-soft); margin: 0; }

.savings-banner {
  background: var(--orange);
  color: #fff;
  text-align: center;
  font-weight: 800;
  font-size: 18px;
  padding: 14px;
  border-radius: var(--radius);
  margin: 6px 0 14px;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 20, 10, 0.55);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 24px; }
}

.modal {
  position: relative;
  background: #fff;
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 20px 24px;
  animation: slideUp 0.22s ease;
}

@media (min-width: 640px) { .modal { border-radius: 18px; } }

@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.modal h2 { margin: 0 32px 4px 0; font-size: 20px; color: var(--orange-dark); }
.modal-sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 10px; font-weight: 600; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--bg);
  font-size: 20px;
  color: var(--ink-soft);
}

.pay-steps { padding-left: 0; list-style: none; margin: 10px 0; }
.pay-steps li { padding: 6px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.pay-steps li:last-child { border-bottom: 0; }

.lipa-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--teal-soft);
  border: 2px dashed var(--teal);
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0 14px;
}

.lipa-box span { font-size: 12px; font-weight: 700; color: var(--teal-dark); }
.lipa-box strong { font-size: 30px; letter-spacing: 4px; color: var(--teal-dark); }

.pay-error { color: var(--danger); font-weight: 700; font-size: 13.5px; }
.input-error { border-color: var(--danger) !important; }

#payCode { text-transform: uppercase; letter-spacing: 2px; font-weight: 800; text-align: center; }

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 60;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 10px rgba(60, 40, 20, 0.08);
}

.nav-btn {
  flex: 1;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  min-height: var(--nav-h);
}

.nav-btn svg { width: 24px; height: 24px; }
.nav-btn.active { color: var(--orange); }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 18px);
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  max-width: 90vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   Landlord management suite (Nyumba Zangu)
   ============================================================ */

/* ---------- Segmented control ---------- */
.seg {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  margin: 10px 0 16px;
  box-shadow: var(--shadow);
}

.seg-btn {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px 8px;
  border-radius: 9px;
  font-weight: 800;
  font-size: 14px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
}

.seg-btn svg { width: 20px; height: 20px; }
.seg-btn.active { background: var(--orange); color: #fff; }

/* ---------- Dashboard stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 6px;
}

@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-label svg { width: 16px; height: 16px; color: var(--teal); flex: 0 0 auto; }
.stat-value { font-size: 19px; font-weight: 800; margin-top: 4px; }
.stat-teal .stat-value { color: var(--teal-dark); }
.stat-alert .stat-value { color: var(--danger); }

/* "Every number is a door": tappable stat cards get a chevron,
   press state and keyboard focus ring (plain numbers get none) */
.stat-link { position: relative; cursor: pointer; padding-right: 30px; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.stat-link:active { transform: scale(0.97); }
@media (hover: hover) {
  .stat-link:hover { box-shadow: 0 5px 16px rgba(60, 40, 20, 0.14); }
}
.stat-chev { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); color: var(--ink-soft); display: flex; }
.stat-chev svg { width: 16px; height: 16px; }

.stat-link:focus-visible,
.mrow:focus-visible,
.panel-link:focus-visible {
  outline: 3px solid rgba(232, 100, 27, 0.45);
  outline-offset: 2px;
}

/* ---------- Rent status badges (thresholds in RENT_SOON_DAYS) ---------- */
.sbadge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: middle;
}

.sbadge-ok { background: var(--teal-soft); color: var(--teal-dark); border: 1px solid var(--teal); }
.sbadge-soon { background: #FFF3D6; color: #8A6D1B; border: 1px solid #E3C56B; }
.sbadge-late { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.sbadge-vacant { background: #EEE9E2; color: var(--ink-soft); border: 1px solid var(--line); }

/* ---------- Row lists (properties, units) ---------- */
.mrow-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

.mrow {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.mrow:active { transform: scale(0.99); }
.mrow-icon { color: var(--orange); display: flex; flex: 0 0 auto; }
.mrow-main { flex: 1; min-width: 0; }
.mrow-title { font-weight: 800; font-size: 15px; }
.mrow-sub { font-size: 12.5px; color: var(--ink-soft); }
.mrow-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; }
.mrow-chev { color: var(--ink-soft); display: flex; flex: 0 0 auto; }

/* ---------- Reminder rows ---------- */
.remind-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

.remind-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.remind-main { min-width: 0; }
.remind-status { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; }
.remind-days { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.remind-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Ledger / expense rows ---------- */
.ledger-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}

.ledger-row:last-of-type { border-bottom: 0; }
.ledger-main { flex: 1; min-width: 0; }
.ledger-amt { font-weight: 800; color: var(--orange-dark); white-space: nowrap; }

.btn-x {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.btn-x:active { background: var(--bg); }
.btn-copy { color: var(--teal); }

.paid-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }

/* ---------- Huduma (utilities) card ---------- */
.huduma-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.huduma-line:last-of-type { border-bottom: 0; }
.huduma-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: var(--ink-soft); flex: 1; }
.huduma-label svg { color: var(--teal); }
.huduma-num { font-weight: 800; letter-spacing: 0.4px; font-size: 14px; text-align: right; }

/* ---------- Print sheets (receipt + contract) ---------- */
.print-sheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  margin-top: 8px;
}

.receipt-sheet { max-width: 520px; margin-left: auto; margin-right: auto; }

.receipt-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--orange); padding-bottom: 12px; margin-bottom: 14px; }
.receipt-brand { font-weight: 800; font-size: 17px; }
.receipt-meta { text-align: right; font-size: 13px; color: var(--ink-soft); }
.receipt-amount { font-size: 30px; font-weight: 800; color: var(--teal-dark); text-align: center; margin: 8px 0 0; }
.receipt-words { text-align: center; color: var(--ink-soft); font-size: 13px; margin: 2px 0 14px; font-style: italic; }
.receipt-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.receipt-table td { padding: 7px 4px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.receipt-table td:first-child { color: var(--ink-soft); font-weight: 600; white-space: nowrap; padding-right: 14px; }
.receipt-footer { text-align: center; color: var(--ink-soft); font-size: 11.5px; margin: 16px 0 0; border-top: 1px solid var(--line); padding-top: 10px; }
.receipt-actions { margin-top: 14px; }

/* ---------- Contract (A4) ---------- */
.contract-doc { font-size: 13.5px; line-height: 1.65; }
.contract-doc h2 { text-align: center; font-size: 17px; letter-spacing: 0.5px; margin: 0 0 14px; }
.contract-doc h3 { font-size: 14px; margin: 16px 0 4px; }
.contract-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0; }
.contract-party { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.contract-party h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.4px; color: var(--ink-soft); }
.contract-party p { margin: 0; font-size: 13px; }
.contract-ol { margin: 4px 0; padding-left: 22px; }
.contract-ol li { margin-bottom: 3px; }

.stamp-note {
  background: #FFF7E0;
  border: 1.5px dashed #E3C56B;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #8A6D1B;
  margin: 16px 0 6px;
}

.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 30px; }
.sig-line { border-top: 1.5px solid var(--ink); padding-top: 4px; font-size: 12px; margin-top: 36px; }
.contract-witnesses { margin-top: 18px; }
.disclaimer { font-size: 11px; color: var(--ink-soft); text-align: center; margin-top: 14px; }

/* ---------- Report chart + table ---------- */
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 16px; justify-content: center; margin: 6px 0 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.table-scroll { overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th { text-align: right; padding: 6px 4px; color: var(--ink-soft); font-size: 11.5px; border-bottom: 1.5px solid var(--line); }
.report-table th:first-child, .report-table td:first-child { text-align: left; font-weight: 700; }
.report-table td { text-align: right; padding: 6px 4px; border-bottom: 1px dashed var(--line); white-space: nowrap; }
.net-pos { color: var(--teal-dark); font-weight: 700; }
.net-neg { color: var(--danger); font-weight: 700; }

/* Report rows / bars are doors to that month's transactions */
.bar-hit { cursor: pointer; }
.row-link { cursor: pointer; }
.row-link:active td { background: var(--bg); }
.row-link:focus-visible { outline: 3px solid rgba(232, 100, 27, 0.45); outline-offset: -2px; }
.row-chev { color: var(--ink-soft); width: 20px; }
.row-chev svg { width: 14px; height: 14px; vertical-align: middle; }

/* ---------- Print (A4, hide app chrome) ---------- */
@media print {
  @page { size: A4; margin: 16mm; }
  body { background: #fff; padding: 0; }
  .app-header, .bottom-nav, #toast, #modalHost, .no-print { display: none !important; }
  main#view { max-width: none; padding: 0; }
  .print-sheet { border: 0; box-shadow: none; border-radius: 0; padding: 0; margin: 0; }
  .receipt-sheet { max-width: none; }
}
