/* ==========================================================================
   Rental Manager - admin theme (built on Bootstrap 5.3)
   ========================================================================== */
:root {
  --rm-primary: #4f46e5;
  --rm-primary-600: #4338ca;
  --rm-primary-soft: rgba(79, 70, 229, .10);
  --rm-bg: #f4f6fb;
  --rm-surface: #ffffff;
  --rm-border: #e8ebf3;
  --rm-text: #1e2433;
  --rm-muted: #6b7489;
  --rm-sidebar: #0f172a;
  --rm-sidebar-2: #162033;
  --rm-sidebar-text: #9aa6bf;
  --rm-radius: 14px;
  --rm-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
  --sidebar-w: 264px;
  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-font-size: .92rem;
  --bs-border-radius: .6rem;
}
[data-bs-theme="dark"] {
  --rm-bg: #0b1020;
  --rm-surface: #141b2e;
  --rm-border: #232c45;
  --rm-text: #e4e8f3;
  --rm-muted: #8e9ab6;
  --rm-primary-soft: rgba(129, 140, 248, .16);
  --rm-sidebar: #070b17;
  --rm-sidebar-2: #101729;
  --rm-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --bs-body-bg: #0b1020;
  --bs-body-color: #e4e8f3;
  --bs-border-color: #232c45;
  --bs-card-bg: #141b2e;
  --bs-secondary-bg: #1a2238;
  --bs-tertiary-bg: #101729;
}

body { background: var(--rm-bg); color: var(--rm-text); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
.text-muted, .text-secondary { color: var(--rm-muted) !important; }
.fw-600 { font-weight: 600; }
.fs-xs { font-size: .78rem; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---- shell ------------------------------------------------------------ */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: linear-gradient(180deg, var(--rm-sidebar) 0%, var(--rm-sidebar-2) 100%);
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.25rem 1rem; color: #fff; }
.sidebar-brand .logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; color: #fff; flex: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 6px 16px rgba(99, 102, 241, .4); overflow: hidden;
}
.sidebar-brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-brand .name { font-weight: 700; line-height: 1.15; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-brand small { color: var(--rm-sidebar-text); font-size: .72rem; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: .25rem .85rem 1rem; }
.sidebar-scroll::-webkit-scrollbar { width: 6px; } .sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 6px; }
.nav-heading { color: #5f6b87; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; padding: 1.1rem .75rem .4rem; }
.sidebar .nav-link {
  display: flex; align-items: center; gap: .75rem; color: var(--rm-sidebar-text); padding: .58rem .75rem; border-radius: 10px;
  font-weight: 500; font-size: .9rem; margin-bottom: 2px; transition: all .15s;
}
.sidebar .nav-link i { font-size: 1.1rem; width: 1.3rem; text-align: center; }
.sidebar .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.sidebar .nav-link.active { color: #fff; background: linear-gradient(135deg, rgba(99, 102, 241, .95), rgba(139, 92, 246, .85)); box-shadow: 0 6px 16px rgba(99, 102, 241, .35); }
.sidebar-foot { padding: .9rem 1.1rem; border-top: 1px solid rgba(255, 255, 255, .07); color: var(--rm-sidebar-text); font-size: .75rem; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; padding: .7rem 1.5rem;
  background: color-mix(in srgb, var(--rm-surface) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rm-border);
}
.topbar .btn-top { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--rm-border); background: var(--rm-surface); color: var(--rm-text); }
.topbar .btn-top:hover { background: var(--rm-primary-soft); color: var(--rm-primary); }
.content { padding: 1.5rem; flex: 1; }
.footer { padding: 1rem 1.5rem; color: var(--rm-muted); font-size: .8rem; }
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .5); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(8, 12, 24, .55); z-index: 1030; }
  .main { margin-left: 0; }
  .content { padding: 1rem; }
  .topbar { padding: .6rem 1rem; }
}

/* ---- page header ------------------------------------------------------- */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.35rem; }
.page-header h1 { font-size: 1.45rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-header .sub { color: var(--rm-muted); font-size: .86rem; margin-top: .15rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---- cards / stats ------------------------------------------------------ */
.card { background: var(--rm-surface); border: 1px solid var(--rm-border); border-radius: var(--rm-radius); box-shadow: var(--rm-shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--rm-border); padding: 1rem 1.25rem; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card-body { padding: 1.25rem; }
.card-footer { background: transparent; border-top: 1px solid var(--rm-border); padding: .75rem 1.25rem; }

.stat-card { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; height: 100%; }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; flex: none; }
.stat-label { color: var(--rm-muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
.stat-sub { font-size: .78rem; color: var(--rm-muted); }
.tone-primary { background: rgba(79, 70, 229, .12); color: #4f46e5; }
.tone-success { background: rgba(16, 185, 129, .14); color: #059669; }
.tone-warning { background: rgba(245, 158, 11, .16); color: #d97706; }
.tone-danger  { background: rgba(239, 68, 68, .13); color: #dc2626; }
.tone-info    { background: rgba(14, 165, 233, .14); color: #0284c7; }
.tone-secondary { background: rgba(100, 116, 139, .14); color: #64748b; }
[data-bs-theme="dark"] .tone-primary { color: #a5b4fc; } [data-bs-theme="dark"] .tone-success { color: #34d399; }
[data-bs-theme="dark"] .tone-warning { color: #fbbf24; } [data-bs-theme="dark"] .tone-danger { color: #f87171; }
[data-bs-theme="dark"] .tone-info { color: #38bdf8; }

.progress { height: 8px; border-radius: 8px; background: var(--rm-border); }
.progress-bar { border-radius: 8px; }

/* ---- tables ------------------------------------------------------------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--rm-muted); font-weight: 700;
  background: color-mix(in srgb, var(--rm-bg) 55%, var(--rm-surface)); border-bottom: 1px solid var(--rm-border); padding: .75rem 1rem; white-space: nowrap;
}
.table > tbody td { padding: .8rem 1rem; border-color: var(--rm-border); vertical-align: middle; }
.table-hover > tbody > tr:hover > * { background: var(--rm-primary-soft); --bs-table-bg-state: transparent; }
.table tfoot td { background: color-mix(in srgb, var(--rm-bg) 55%, var(--rm-surface)); font-weight: 600; border-color: var(--rm-border); padding: .75rem 1rem; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions > * { margin-left: .15rem; }

/* ---- badges / buttons / avatars ---------------------------------------- */
.badge-soft { font-weight: 600; padding: .38em .7em; border-radius: 999px; font-size: .72rem; letter-spacing: .01em; }
.badge-soft.bg-success   { background: rgba(16, 185, 129, .14) !important; color: #059669 !important; }
.badge-soft.bg-primary   { background: rgba(79, 70, 229, .12) !important; color: #4f46e5 !important; }
.badge-soft.bg-warning   { background: rgba(245, 158, 11, .16) !important; color: #b45309 !important; }
.badge-soft.bg-danger    { background: rgba(239, 68, 68, .13) !important; color: #dc2626 !important; }
.badge-soft.bg-info      { background: rgba(14, 165, 233, .14) !important; color: #0369a1 !important; }
.badge-soft.bg-secondary { background: rgba(100, 116, 139, .15) !important; color: #475569 !important; }
[data-bs-theme="dark"] .badge-soft.bg-success { color: #34d399 !important; } [data-bs-theme="dark"] .badge-soft.bg-primary { color: #a5b4fc !important; }
[data-bs-theme="dark"] .badge-soft.bg-warning { color: #fbbf24 !important; } [data-bs-theme="dark"] .badge-soft.bg-danger { color: #f87171 !important; }
[data-bs-theme="dark"] .badge-soft.bg-info { color: #38bdf8 !important; } [data-bs-theme="dark"] .badge-soft.bg-secondary { color: #a6b0c6 !important; }

.btn { font-weight: 600; border-radius: 10px; }
.btn-primary { background: var(--rm-primary); border-color: var(--rm-primary); box-shadow: 0 4px 12px rgba(79, 70, 229, .28); }
.btn-primary:hover, .btn-primary:focus { background: var(--rm-primary-600); border-color: var(--rm-primary-600); }
.btn-outline-primary { color: var(--rm-primary); border-color: var(--rm-primary); } .btn-outline-primary:hover { background: var(--rm-primary); border-color: var(--rm-primary); }
.btn-light-border { background: var(--rm-surface); border: 1px solid var(--rm-border); color: var(--rm-text); }
.btn-light-border:hover { background: var(--rm-primary-soft); color: var(--rm-primary); border-color: transparent; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; border-radius: 9px; }
.btn-soft-primary { background: rgba(79, 70, 229, .1); color: #4f46e5; border: 0; } .btn-soft-primary:hover { background: #4f46e5; color: #fff; }
.btn-soft-danger  { background: rgba(239, 68, 68, .1); color: #dc2626; border: 0; } .btn-soft-danger:hover { background: #dc2626; color: #fff; }
.btn-soft-success { background: rgba(16, 185, 129, .12); color: #059669; border: 0; } .btn-soft-success:hover { background: #059669; color: #fff; }
.btn-soft-warning { background: rgba(245, 158, 11, .15); color: #b45309; border: 0; } .btn-soft-warning:hover { background: #d97706; color: #fff; }
.btn-soft-secondary { background: rgba(100, 116, 139, .13); color: #475569; border: 0; } .btn-soft-secondary:hover { background: #64748b; color: #fff; }
[data-bs-theme="dark"] .btn-soft-secondary { color: #b6c0d6; } [data-bs-theme="dark"] .btn-soft-primary { color: #a5b4fc; }

.avatar { border-radius: 50%; object-fit: cover; flex: none; }
.avatar-initials { display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: .8rem; }

/* ---- forms ---------------------------------------------------------------- */
.form-label { font-weight: 600; font-size: .83rem; margin-bottom: .35rem; }
.form-control, .form-select { border-color: var(--rm-border); border-radius: 10px; padding: .55rem .8rem; background-color: var(--rm-surface); }
.form-control:focus, .form-select:focus { border-color: var(--rm-primary); box-shadow: 0 0 0 .22rem rgba(79, 70, 229, .15); }
.input-group-text { border-color: var(--rm-border); background: var(--rm-bg); border-radius: 10px; color: var(--rm-muted); }
.form-section-title { font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--rm-muted); margin: .25rem 0 .9rem; }
.filter-bar .form-control, .filter-bar .form-select { background-color: var(--rm-surface); }

/* ---- misc widgets ------------------------------------------------------------ */
.detail-list { margin: 0; } .detail-list dt { color: var(--rm-muted); font-weight: 500; font-size: .82rem; }
.detail-list dd { font-weight: 600; margin-bottom: .7rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--rm-muted); }
.empty-state i { font-size: 2.6rem; opacity: .45; display: block; margin-bottom: .6rem; }
.list-row { display: flex; align-items: center; gap: .8rem; padding: .75rem 0; border-bottom: 1px dashed var(--rm-border); }
.list-row:last-child { border-bottom: 0; }
.chart-box { position: relative; height: 290px; }

/* building view: room tiles */
.floor-block + .floor-block { margin-top: 1.4rem; }
.floor-title { font-weight: 700; margin-bottom: .6rem; display: flex; align-items: center; gap: .6rem; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.room-tile {
  display: block; color: var(--rm-text); border: 1px solid var(--rm-border); border-left-width: 5px; border-radius: 12px;
  padding: .75rem .9rem; background: var(--rm-surface); transition: transform .15s, box-shadow .15s;
}
.room-tile:hover { transform: translateY(-2px); box-shadow: var(--rm-shadow); color: var(--rm-text); }
.room-tile.vacant { border-left-color: #10b981; } .room-tile.occupied { border-left-color: #4f46e5; } .room-tile.maintenance { border-left-color: #f59e0b; }
.room-tile .no { font-weight: 700; font-size: 1.05rem; } .room-tile .meta { font-size: .76rem; color: var(--rm-muted); }

.timeline-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: .5rem; }
.nav-pills-soft .nav-link { color: var(--rm-muted); font-weight: 600; border-radius: 10px; }
.nav-pills-soft .nav-link.active { background: var(--rm-primary-soft); color: var(--rm-primary); }
.nav-tabs .nav-link { color: var(--rm-muted); font-weight: 600; border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--rm-primary); border-bottom-color: var(--rm-primary); background: transparent; }
.nav-tabs { border-bottom-color: var(--rm-border); }
.report-tile { display: flex; gap: 1rem; align-items: flex-start; padding: 1.25rem; color: var(--rm-text); height: 100%; transition: transform .15s, box-shadow .15s; }
.report-tile:hover { transform: translateY(-3px); color: var(--rm-text); box-shadow: 0 10px 28px rgba(79, 70, 229, .14); }

/* ---- auth page ------------------------------------------------------------ */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--rm-surface); }
.auth-art {
  position: relative; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  background: radial-gradient(1200px 600px at 10% -10%, #6366f1 0%, transparent 60%), radial-gradient(900px 500px at 100% 110%, #8b5cf6 0%, transparent 55%), #0f172a;
}
.auth-art::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); pointer-events: none; }
.auth-art > * { position: relative; z-index: 1; }
.auth-art h2 { font-weight: 800; font-size: 2.2rem; letter-spacing: -.02em; line-height: 1.15; }
.auth-art .feature { display: flex; align-items: center; gap: .7rem; color: rgba(255,255,255,.85); margin-top: .7rem; }
.auth-art .feature i { background: rgba(255,255,255,.14); width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-form .box { width: 100%; max-width: 400px; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* ---- print ------------------------------------------------------------------ */
.doc-sheet { max-width: 820px; margin: 1.5rem auto; background: #fff; color: #1b2333; border: 1px solid #e5e7ef; border-radius: 12px; padding: 2.4rem 2.6rem; box-shadow: var(--rm-shadow); }
.doc-sheet h1, .doc-sheet h2, .doc-sheet h3, .doc-sheet h4, .doc-sheet th { color: #1b2333; }
.doc-sheet .table > thead th { background: #f3f5fa; color: #5b6479; }
.doc-sheet .table > tbody td, .doc-sheet .table tfoot td { border-color: #e5e7ef; background: transparent; }
.doc-sheet .muted { color: #6b7489; }
.doc-brand { display: flex; justify-content: space-between; gap: 1.5rem; border-bottom: 3px solid var(--rm-primary); padding-bottom: 1.1rem; margin-bottom: 1.5rem; }
.doc-title { font-size: 1.9rem; font-weight: 800; letter-spacing: .06em; color: var(--rm-primary) !important; text-transform: uppercase; }
.stamp { display: inline-block; border: 3px solid; border-radius: 8px; padding: .15rem .9rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; transform: rotate(-6deg); font-size: 1.15rem; }
.stamp.paid { color: #059669; border-color: #059669; } .stamp.unpaid, .stamp.overdue { color: #dc2626; border-color: #dc2626; } .stamp.partial { color: #d97706; border-color: #d97706; }
.toolbar-print { max-width: 820px; margin: 1rem auto 0; display: flex; gap: .5rem; justify-content: flex-end; }

@media print {
  body { background: #fff !important; }
  .sidebar, .topbar, .footer, .no-print, .page-actions, .toolbar-print, .sidebar-backdrop, .filter-bar, .pagination { display: none !important; }
  .main { margin-left: 0 !important; } .content { padding: 0 !important; }
  .card { box-shadow: none !important; border-color: #ddd !important; }
  .doc-sheet { border: 0; box-shadow: none; margin: 0; max-width: none; padding: 0; }
  a { color: inherit !important; }
  .table-responsive { overflow: visible !important; }
}
