/* RentMan Design System */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --rm-primary: #0f4c75;
  --rm-primary-dark: #0a3554;
  --rm-primary-light: #e8f4fc;
  --rm-accent: #0d9488;
  --rm-accent-light: #ccfbf1;
  --rm-bg: #f0f4f8;
  --rm-surface: #ffffff;
  --rm-border: #e2e8f0;
  --rm-text: #0f172a;
  --rm-muted: #64748b;
  --rm-danger: #dc2626;
  --rm-danger-light: #fef2f2;
  --rm-success: #16a34a;
  --rm-success-light: #f0fdf4;
  --rm-warning: #d97706;
  --rm-warning-light: #fffbeb;
  --rm-radius: 12px;
  --rm-radius-sm: 8px;
  --rm-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --rm-shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --rm-sidebar-w: 240px;
  --rm-topnav-h: 56px;
  --rm-bottomnav-h: 64px;
  --rm-font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--rm-font);
  background: var(--rm-bg);
  color: var(--rm-text);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────── */
.rm-app {
  display: flex;
  min-height: 100vh;
}

.rm-sidebar {
  width: var(--rm-sidebar-w);
  background: linear-gradient(180deg, var(--rm-primary) 0%, var(--rm-primary-dark) 100%);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.rm-sidebar-brand {
  padding: 20px 20px 16px;
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.rm-sidebar-brand i { font-size: 1.4rem; opacity: .9; }

.rm-sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}

.rm-sidebar-nav .nav-link {
  color: rgba(255,255,255,.72);
  border-radius: var(--rm-radius-sm);
  padding: 9px 14px;
  margin-bottom: 2px;
  font-size: .875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all .15s ease;
}

.rm-sidebar-nav .nav-link i { width: 20px; font-size: 1rem; opacity: .85; }

.rm-sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.rm-sidebar-nav .nav-link.active {
  background: rgba(255,255,255,.18);
  color: #fff;
  font-weight: 600;
}

.rm-sidebar-nav .nav-divider {
  border-color: rgba(255,255,255,.15);
  margin: 10px 4px;
}

.rm-sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.6);
  font-size: .75rem;
}

.rm-main {
  flex: 1;
  margin-left: var(--rm-sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.rm-topbar {
  height: var(--rm-topnav-h);
  background: var(--rm-surface);
  border-bottom: 1px solid var(--rm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.rm-topbar-title {
  font-weight: 600;
  font-size: .95rem;
  color: var(--rm-muted);
}

.rm-topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .875rem;
}

.rm-topbar-user .user-name {
  color: var(--rm-muted);
  font-weight: 500;
}

.rm-content {
  padding: 24px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

/* ── Mobile ─────────────────────────────────────────────── */
.rm-mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--rm-topnav-h);
  background: var(--rm-primary);
  color: #fff;
  z-index: 1040;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.rm-mobile-header .brand {
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
}

.rm-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--rm-bottomnav-h);
  background: var(--rm-surface);
  border-top: 1px solid var(--rm-border);
  z-index: 1040;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.rm-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--rm-muted);
  text-decoration: none;
  font-size: .65rem;
  font-weight: 500;
  padding: 6px 0;
  transition: color .15s;
}

.rm-bottom-nav a i { font-size: 1.25rem; }

.rm-bottom-nav a.active,
.rm-bottom-nav a:hover { color: var(--rm-primary); }

.rm-offcanvas-nav .nav-link {
  color: var(--rm-text);
  border-radius: var(--rm-radius-sm);
  padding: 10px 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.rm-offcanvas-nav .nav-link i { width: 22px; color: var(--rm-primary); }

.rm-offcanvas-nav .nav-link:hover { background: var(--rm-primary-light); }

@media (max-width: 767.98px) {
  .rm-sidebar, .rm-topbar { display: none; }
  .rm-mobile-header { display: flex; }
  .rm-bottom-nav { display: flex; }
  .rm-main {
    margin-left: 0;
    padding-top: var(--rm-topnav-h);
    padding-bottom: calc(var(--rm-bottomnav-h) + 16px);
  }
  .rm-content { padding: 16px; }
}

/* ── Page Header ────────────────────────────────────────── */
.rm-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.rm-page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.rm-page-header h1 i {
  color: var(--rm-primary);
  font-size: 1.3rem;
}

.rm-page-header .subtitle {
  color: var(--rm-muted);
  font-size: .875rem;
  margin-top: 4px;
}

@media (max-width: 767.98px) {
  .rm-page-header h1 { font-size: 1.25rem; }
}

/* ── Cards ────────────────────────────────────────────────── */
.rm-card {
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius);
  box-shadow: var(--rm-shadow);
  overflow: hidden;
}

.rm-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--rm-border);
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--rm-surface);
}

.rm-card-body { padding: 18px; }

.rm-card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--rm-border);
  background: #fafbfc;
}

/* Stat cards */
.rm-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 991.98px) {
  .rm-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

.rm-stat-card {
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--rm-shadow);
  transition: box-shadow .15s;
}

.rm-stat-card:hover { box-shadow: var(--rm-shadow-md); }

.rm-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.rm-stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.rm-stat-icon.green { background: #dcfce7; color: #16a34a; }
.rm-stat-icon.amber { background: #fef3c7; color: #d97706; }
.rm-stat-icon.slate { background: #f1f5f9; color: #475569; }
.rm-stat-icon.teal { background: var(--rm-accent-light); color: var(--rm-accent); }
.rm-stat-icon.red { background: var(--rm-danger-light); color: var(--rm-danger); }

.rm-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.rm-stat-label {
  font-size: .8rem;
  color: var(--rm-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-rm-primary {
  background: var(--rm-primary);
  color: #fff;
  border: none;
  border-radius: var(--rm-radius-sm);
  padding: 8px 16px;
  font-weight: 600;
  font-size: .875rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s;
}

.btn-rm-primary:hover { background: var(--rm-primary-dark); color: #fff; }

.btn-rm-accent {
  background: var(--rm-accent);
  color: #fff;
  border: none;
  border-radius: var(--rm-radius-sm);
  padding: 8px 16px;
  font-weight: 600;
  font-size: .875rem;
}

.btn-rm-accent:hover { background: #0f766e; color: #fff; }

.btn-rm-outline {
  background: transparent;
  color: var(--rm-primary);
  border: 1.5px solid var(--rm-border);
  border-radius: var(--rm-radius-sm);
  padding: 7px 15px;
  font-weight: 600;
  font-size: .875rem;
}

.btn-rm-outline:hover {
  background: var(--rm-primary-light);
  border-color: var(--rm-primary);
  color: var(--rm-primary);
}

/* ── Tables ───────────────────────────────────────────────── */
.rm-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.rm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.rm-table th {
  background: #f8fafc;
  color: var(--rm-muted);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rm-border);
  white-space: nowrap;
}

.rm-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--rm-border);
  vertical-align: middle;
}

.rm-table tbody tr:hover { background: #f8fafc; }

.rm-table tbody tr:last-child td { border-bottom: none; }

/* Mobile card rows */
.rm-mobile-cards { display: none; }

@media (max-width: 767.98px) {
  .rm-table-desktop { display: none; }
  .rm-mobile-cards { display: flex; flex-direction: column; gap: 10px; }
}

.rm-mobile-card {
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius-sm);
  padding: 14px;
}

.rm-mobile-card .rm-mc-title {
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 4px;
}

.rm-mobile-card .rm-mc-row {
  display: flex;
  justify-content: space-between;
  font-size: .8rem;
  color: var(--rm-muted);
  margin-top: 4px;
}

/* ── Badges ───────────────────────────────────────────────── */
.rm-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.rm-badge-success { background: #dcfce7; color: #15803d; }
.rm-badge-warning { background: #fef3c7; color: #b45309; }
.rm-badge-danger { background: #fee2e2; color: #b91c1c; }
.rm-badge-muted { background: #f1f5f9; color: #475569; }
.rm-badge-primary { background: var(--rm-primary-light); color: var(--rm-primary); }

/* ── Balance colors ─────────────────────────────────────────── */
.balance-due { color: var(--rm-danger); font-weight: 600; }
.balance-clear { color: var(--rm-success); font-weight: 600; }

/* ── Forms ──────────────────────────────────────────────────── */
.rm-form-card {
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius);
  box-shadow: var(--rm-shadow);
  max-width: 640px;
}

.rm-form-card .rm-card-body { padding: 24px; }

.form-label {
  font-weight: 600;
  font-size: .85rem;
  color: var(--rm-text);
  margin-bottom: 6px;
}

.form-control, .form-select {
  border: 1.5px solid var(--rm-border);
  border-radius: var(--rm-radius-sm);
  padding: 9px 12px;
  font-size: .9rem;
  font-family: var(--rm-font);
}

.form-control:focus, .form-select:focus {
  border-color: var(--rm-primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 117, .12);
}

/* Payment mode pills */
.rm-mode-pills { display: flex; flex-wrap: wrap; gap: 8px; }

.rm-mode-pills .btn-check + label {
  border-radius: 20px !important;
  font-size: .8rem;
  font-weight: 600;
  padding: 6px 14px;
}

.rm-mode-pills .btn-check:checked + label {
  background: var(--rm-primary) !important;
  border-color: var(--rm-primary) !important;
  color: #fff !important;
}

/* ── Filter bar ───────────────────────────────────────────── */
.rm-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}

.rm-filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.rm-filter-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
  border: 1.5px solid var(--rm-border);
  background: var(--rm-surface);
  color: var(--rm-muted);
  text-decoration: none;
  transition: all .15s;
}

.rm-filter-pill:hover { border-color: var(--rm-primary); color: var(--rm-primary); }

.rm-filter-pill.active {
  background: var(--rm-primary);
  border-color: var(--rm-primary);
  color: #fff;
}

/* ── Property cards grid ──────────────────────────────────── */
.rm-prop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.rm-prop-card {
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius);
  overflow: hidden;
  box-shadow: var(--rm-shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, transform .15s;
}

.rm-prop-card:hover {
  box-shadow: var(--rm-shadow-md);
  transform: translateY(-1px);
}

.rm-prop-card-body { padding: 18px; flex: 1; }

.rm-prop-card-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.rm-prop-card-meta {
  font-size: .8rem;
  color: var(--rm-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rm-prop-card-meta i { width: 16px; }

.rm-prop-card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--rm-border);
  display: flex;
  gap: 8px;
}

/* ── Bank account cards ───────────────────────────────────── */
.rm-bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.rm-bank-card {
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius);
  padding: 20px;
  box-shadow: var(--rm-shadow);
  position: relative;
  overflow: hidden;
}

.rm-bank-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--rm-primary), var(--rm-accent));
}

.rm-bank-card.inactive { opacity: .55; }

.rm-bank-card .bank-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
}

.rm-bank-card .bank-detail {
  font-size: .8rem;
  color: var(--rm-muted);
  margin-top: 3px;
}

.rm-bank-card .bank-acct {
  font-family: 'Courier New', monospace;
  font-size: .85rem;
  letter-spacing: .05em;
  margin-top: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 6px;
}

/* ── Reports ──────────────────────────────────────────────── */
.rm-report-tabs .nav-link {
  color: var(--rm-muted);
  font-weight: 600;
  font-size: .875rem;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 18px;
}

.rm-report-tabs .nav-link.active {
  color: var(--rm-primary);
  border-bottom-color: var(--rm-primary);
  background: transparent;
}

.rm-report-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rm-border);
  text-decoration: none;
  color: inherit;
  transition: background .12s;
}

.rm-report-item:hover { background: #f8fafc; color: inherit; }

.rm-report-item:last-child { border-bottom: none; }

.rm-report-item .ri-title { font-weight: 600; font-size: .9rem; }
.rm-report-item .ri-sub { font-size: .78rem; color: var(--rm-muted); margin-top: 2px; }

/* ── Empty state ────────────────────────────────────────────── */
.rm-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--rm-muted);
}

.rm-empty i { font-size: 2.5rem; opacity: .4; margin-bottom: 12px; display: block; }

/* ── Quick actions ──────────────────────────────────────────── */
.rm-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  border-radius: var(--rm-radius-sm);
  font-size: .875rem;
  border: none;
}

.alert-success { background: var(--rm-success-light); color: #15803d; }
.alert-danger { background: var(--rm-danger-light); color: #b91c1c; }
.alert-warning { background: var(--rm-warning-light); color: #b45309; }
.alert-info { background: var(--rm-primary-light); color: var(--rm-primary); }

/* ── AI FAB ─────────────────────────────────────────────────── */
.rm-ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rm-accent), #0891b2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 16px rgba(13, 148, 136, .4);
  text-decoration: none;
  z-index: 1020;
  transition: transform .15s;
}

.rm-ai-fab:hover { color: #fff; transform: scale(1.05); }

@media (max-width: 767.98px) {
  .rm-ai-fab {
    bottom: calc(var(--rm-bottomnav-h) + 12px);
    right: 16px;
    width: 48px;
    height: 48px;
  }
}

/* ── Payment form extras ────────────────────────────────────── */
.rm-lease-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.rm-split-box {
  background: var(--rm-primary-light);
  border: 1px solid #bde0fe;
  border-radius: var(--rm-radius-sm);
  padding: 12px 14px;
  font-size: .85rem;
  margin-top: 10px;
}

.rm-tds-block {
  background: #f8fafc;
  border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius-sm);
  padding: 16px;
}

/* ── Reminder cards ─────────────────────────────────────────── */
.rm-reminder-section { margin-bottom: 24px; }

.rm-reminder-section .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: var(--rm-radius) var(--rm-radius) 0 0;
  font-weight: 600;
}

.rm-reminder-section.overdue .section-header {
  background: var(--rm-danger);
  color: #fff;
}

.rm-reminder-section.upcoming .section-header {
  background: var(--rm-warning-light);
  color: #92400e;
  border: 1px solid #fde68a;
  border-bottom: none;
}

/* ── Auth pages ─────────────────────────────────────────────── */
.rm-auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--rm-primary) 0%, var(--rm-primary-dark) 50%, #0d9488 100%);
  padding: 20px;
}

.rm-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--rm-surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow: hidden;
}

.rm-auth-header {
  background: linear-gradient(135deg, var(--rm-primary), var(--rm-primary-dark));
  color: #fff;
  padding: 36px 32px;
  text-align: center;
}

.rm-auth-header i { font-size: 2.5rem; opacity: .9; }
.rm-auth-header h2 { margin: 12px 0 4px; font-weight: 700; }
.rm-auth-header p { margin: 0; opacity: .75; font-size: .875rem; }

.rm-auth-body { padding: 32px; }

/* ── Search box ─────────────────────────────────────────────── */
.rm-search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.rm-search input {
  padding-left: 36px;
}

.rm-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--rm-muted);
}
