/* Tenant portal styles — shared across all tenant views */
:root {
  --cream: #FAF8F5;
  --white: #FFFFFF;
  --teal: #1E7A5F;
  --teal-dark: #165A4A;
  --teal-light: #E8F5F1;
  --text: #1A1A1A;
  --muted: #6B7280;
  --border: #D1D5DB;
  --shadow: 0 2px 16px rgba(0,0,0,0.07);
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --warning: #D97706;
  --warning-light: #FEF3C7;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Source Sans 3', sans-serif; background: var(--cream); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 0 2rem; display: flex; align-items: center; height: 56px; flex-shrink: 0; }
.topbar-logo { font-family: 'Lora', serif; font-size: 1.1rem; font-weight: 700; color: var(--teal); text-decoration: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.account-info { font-size: 0.85rem; color: var(--muted); }
.account-info strong { color: var(--text); }

/* ── Layout ─────────────────────────────────────────────── */
.layout { display: flex; flex: 1; }
.sidebar { width: 200px; background: var(--white); border-right: 1px solid var(--border); padding: 1.5rem 0; flex-shrink: 0; }
.main { flex: 1; padding: 2rem; overflow-y: auto; }

/* ── Nav ─────────────────────────────────────────────────── */
.nav-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.65rem 1.5rem; color: var(--muted); text-decoration: none; font-size: 0.9rem; font-weight: 500; border-right: 3px solid transparent; transition: all 0.15s; }
.nav-item:hover { color: var(--text); background: var(--cream); }
.nav-item.active { color: var(--teal); border-right-color: var(--teal); background: var(--teal-light); font-weight: 600; }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

/* ── Typography ─────────────────────────────────────────── */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.75rem; }
.page-title { font-family: 'Lora', serif; font-size: 1.6rem; font-weight: 700; }
.page-sub { color: var(--muted); font-size: 0.9rem; margin-top: 0.2rem; }
.section-title { font-family: 'Lora', serif; font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }

/* ── Buttons ────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 8px 18px; border-radius: 8px; font-family: 'Source Sans 3', sans-serif; font-size: 0.875rem; font-weight: 600; cursor: pointer; border: none; transition: background 0.15s; text-decoration: none; }
.btn-primary { background: var(--teal); color: white; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { border-color: var(--text); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #B91C1C; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.logout-btn { background: none; border: 1px solid var(--border); color: var(--muted); padding: 4px 14px; border-radius: 6px; font-size: 0.82rem; cursor: pointer; font-family: 'Source Sans 3', sans-serif; transition: all 0.15s; }
.logout-btn:hover { border-color: var(--text); color: var(--text); }

/* ── Cards ──────────────────────────────────────────────── */
.card { background: var(--white); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1.5rem; }
.card-pad { padding: 1.5rem; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.badge-urgent { background: var(--danger-light); color: var(--danger); }
.badge-routine { background: #EFF6FF; color: #1D4ED8; }
.badge-submitted { background: #FEF3C7; color: #92400E; }
.badge-scheduled { background: #EFF6FF; color: #1D4ED8; }
.badge-in_progress { background: var(--teal-light); color: var(--teal); }
.badge-dispatched { background: var(--teal-light); color: var(--teal); }
.badge-resolved { background: #F0FDF4; color: #15803D; }
.badge-cancelled { background: #F3F4F6; color: var(--muted); }
.badge-paid { background: #F0FDF4; color: #15803D; }
.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-overdue { background: var(--danger-light); color: var(--danger); }
.badge-partial { background: #EFF6FF; color: #1D4ED8; }

/* ── Tables ──────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 0.7rem 1.25rem; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; background: var(--cream); border-bottom: 1px solid var(--border); font-weight: 600; }
td { padding: 1rem 1.25rem; border-bottom: 1px solid #F3F4F6; font-size: 0.88rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--teal-light); }
.clickable-row { cursor: pointer; }

/* ── Info grid ──────────────────────────────────────────── */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.info-item { background: var(--white); border-radius: 12px; box-shadow: var(--shadow); padding: 1.25rem; }
.info-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 0.3rem; }
.info-value { font-size: 1rem; font-weight: 600; color: var(--text); }
.info-value.muted { color: var(--muted); font-weight: 400; }

/* ── Flash banners ─────────────────────────────────────── */
.flash { padding: 0.75rem 1.25rem; border-radius: 8px; font-size: 0.88rem; margin-bottom: 1.25rem; }
.flash-success { background: #F0FDF4; color: #15803D; border: 1px solid rgba(21,128,61,0.2); }
.flash-error { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(220,38,38,0.2); }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.4rem; }
.form-control { width: 100%; padding: 0.65rem 0.9rem; border: 1px solid var(--border); border-radius: 8px; font-family: 'Source Sans 3', sans-serif; font-size: 0.9rem; transition: border-color 0.15s; }
.form-control:focus { outline: none; border-color: var(--teal); }
.form-hint { font-size: 0.78rem; color: var(--muted); margin-top: 0.3rem; }
.error { background: var(--danger-light); color: var(--danger); padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.85rem; margin-bottom: 1rem; border: 1px solid rgba(220,38,38,0.2); }
textarea.form-control { resize: vertical; min-height: 120px; }
.radio-group { display: flex; gap: 1rem; margin-top: 0.35rem; }
.radio-item { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; font-size: 0.9rem; }

/* ── Detail view ────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.detail-section { background: var(--white); border-radius: 12px; box-shadow: var(--shadow); padding: 1.5rem; }
.detail-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid #F3F4F6; font-size: 0.88rem; }
.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--muted); }
.detail-row .value { font-weight: 600; }
.vendor-card { background: var(--teal-light); border-radius: 10px; padding: 1rem; border: 1px solid rgba(30,122,95,0.2); }
.vendor-card .vendor-name { font-weight: 600; margin-bottom: 0.25rem; }
.vendor-card .vendor-meta { font-size: 0.82rem; color: var(--muted); }
.vendor-card .vendor-contact { font-size: 0.85rem; margin-top: 0.4rem; }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 50; display: none; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: 16px; padding: 2rem; max-width: 420px; width: 90%; }
.modal h3 { font-family: 'Lora', serif; font-size: 1.2rem; margin-bottom: 1rem; }
.modal p { color: var(--muted); font-size: 0.88rem; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ── Misc ───────────────────────────────────────────────── */
.empty { padding: 3rem 2rem; text-align: center; color: var(--muted); }
.empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty h3 { font-family: 'Lora', serif; font-size: 1.1rem; color: var(--text); margin-bottom: 0.4rem; }
.empty p { font-size: 0.88rem; }
.back-link { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--teal); text-decoration: none; font-size: 0.85rem; margin-bottom: 1rem; }
.back-link:hover { text-decoration: underline; }

/* ── Payment section ────────────────────────────────────── */
.pay-banner { background: var(--white); border-radius: 12px; box-shadow: var(--shadow); padding: 1.5rem; display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.pay-amount { font-family: 'Lora', serif; font-size: 1.5rem; font-weight: 700; }
.pay-meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.pay-actions { display: flex; gap: 0.75rem; }

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 0; display: flex; gap: 0; overflow-x: auto; }
  .sidebar .nav-item { padding: 0.75rem 1rem; border-right: none; border-bottom: 3px solid transparent; white-space: nowrap; flex-shrink: 0; }
  .sidebar .nav-item.active { border-bottom-color: var(--teal); }
  .main { padding: 1.25rem; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .pay-banner { flex-direction: column; align-items: flex-start; gap: 1rem; }
}