:root {
  --slate-50: #f8fafc; --slate-100: #f1f5f9; --slate-200: #e2e8f0; --slate-300: #cbd5e1;
  --slate-400: #94a3b8; --slate-500: #64748b; --slate-600: #475569; --slate-700: #334155;
  --slate-900: #0f172a;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bs-body-color: var(--slate-900);
  --bs-border-color: var(--slate-200);
  --bs-link-color-rgb: 15, 23, 42;
  --bs-link-hover-color-rgb: 29, 78, 216;
}
body { background: var(--slate-50); font-size: .925rem; }
a { text-decoration: none; }
.min-w-0 { min-width: 0; }
.fw-medium { font-weight: 500; }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 256px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--slate-200);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 1040;
}
.main-column { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; background: #fff; border-bottom: 1px solid var(--slate-200);
  display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 1020;
}
.content { padding: 32px; max-width: 1280px; width: 100%; margin: 0 auto; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 1030; }
  .content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
}

.org-switcher { padding: 12px; border-bottom: 1px solid var(--slate-200); }
.org-button {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; font-weight: 700; text-align: left;
}
.org-button:hover { background: var(--slate-100); }
.org-button i { color: var(--slate-400); }

.side-nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.side-link {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px;
  color: var(--slate-600); font-weight: 500;
}
.side-link i { font-size: 1.15rem; }
.side-link:hover { background: var(--slate-50); color: var(--slate-900); }
.side-link.active { background: var(--slate-100); color: var(--slate-900); }

.sidebar-footer { border-top: 1px solid var(--slate-200); padding: 16px; }
.user-chip { display: flex; align-items: center; gap: 12px; padding: 4px; border-radius: 8px; color: var(--slate-900); }
.user-chip:hover { background: var(--slate-50); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--slate-200); color: var(--slate-600);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0;
}
.logout-link {
  margin-top: 8px; width: 100%; border: 0; background: transparent; color: var(--slate-500);
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: .875rem;
}
.logout-link:hover { background: var(--slate-100); color: var(--slate-700); }

.topbar-search { position: relative; flex: 1; max-width: 420px; }
.topbar-search i, .search-input i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--slate-400); }
.topbar-search input, .search-input input { padding-left: 36px; }

.lang-switch { display: inline-flex; border: 1px solid var(--slate-200); border-radius: 8px; overflow: hidden; }
.lang-switch form { margin: 0; }
.lang-switch button { border: 0; background: #fff; padding: 4px 10px; font-size: .75rem; font-weight: 600; color: var(--slate-500); }
.lang-switch button.active { background: var(--slate-900); color: #fff; }

/* Elements */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; font-weight: 500; font-size: .875rem; }
.btn-dark { background: var(--slate-900); border-color: var(--slate-900); }
.btn-icon { padding: 6px; border: 0; color: var(--slate-400); background: transparent; }
.btn-icon:hover { background: var(--slate-100); color: var(--slate-700); }
.form-control, .form-select { border-radius: 8px; border-color: var(--slate-300); font-size: .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--slate-500); box-shadow: 0 0 0 3px rgba(100, 116, 139, .15); }
.form-label { font-size: .85rem; font-weight: 500; color: var(--slate-700); margin-bottom: 4px; }

.page-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-description { margin: 4px 0 0; color: var(--slate-500); font-size: .875rem; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.card-box { background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; padding: 20px 24px; }
.table-card { background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; overflow: hidden; }
.table-card-header { padding: 16px 20px; border-bottom: 1px solid var(--slate-200); }
.section-title, .card-title-sm { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-500); margin-bottom: 16px; }
.card-title-sm { margin: 0; color: var(--slate-900); text-transform: none; letter-spacing: 0; font-size: .9rem; }
.detail-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-400); margin-bottom: 6px; }
.notes { white-space: pre-line; }
.amount { font-size: 1.15rem; font-weight: 700; }
.amount-lg { font-size: 1.5rem; font-weight: 700; }
.occupancy { font-size: 1.5rem; font-weight: 700; }
.occupancy span { font-size: 1rem; font-weight: 400; color: var(--slate-400); }

.data-table { font-size: .875rem; }
.data-table thead th {
  background: var(--slate-50); color: var(--slate-500); font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; border-bottom: 1px solid var(--slate-200); white-space: nowrap;
}
.data-table td { padding: 12px 16px; vertical-align: middle; color: var(--slate-600); border-color: var(--slate-100); }
.data-table td.fw-medium { color: var(--slate-900); }
.data-table tfoot td { background: var(--slate-50); color: var(--slate-900); border-top: 1px solid var(--slate-200); }
.data-table tbody tr:last-child td { border-bottom: 0; }
tr[data-href] { cursor: pointer; }
.wide-table { min-width: 1100px; }
.wide-table td { white-space: nowrap; }

.badge-soft { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 500; white-space: nowrap; }
.badge-soft.success { background: #ecfdf5; color: #047857; }
.badge-soft.neutral { background: var(--slate-100); color: var(--slate-600); }
.badge-soft.warning { background: #fffbeb; color: #b45309; }
.badge-soft.info { background: #eff6ff; color: #1d4ed8; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.search-input { position: relative; flex: 1; min-width: 220px; max-width: 420px; }

.empty-state { text-align: center; padding: 56px 16px; background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; }
.empty-state > i { font-size: 2.5rem; color: var(--slate-300); }
.empty-title { font-weight: 600; margin: 12px 0 4px; }
.empty-description { color: var(--slate-500); font-size: .875rem; margin-bottom: 16px; }

.profile-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--slate-200); margin-bottom: 24px; overflow-x: auto; }
.profile-tabs a {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-weight: 500; color: var(--slate-500);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.profile-tabs a:hover { color: var(--slate-700); }
.profile-tabs a.active { color: var(--slate-900); border-bottom-color: var(--slate-900); }

.form-page { max-width: 720px; }
.form-page-wide { max-width: 860px; }
.form-actions { display: flex; gap: 12px; padding-top: 8px; }
.money-box { border: 1px solid var(--slate-200); background: var(--slate-50); border-radius: 12px; padding: 16px; }

/* Dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 991.98px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card { background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; padding: 20px; display: flex; justify-content: space-between; align-items: center; transition: box-shadow .15s; }
.stat-card:hover { box-shadow: 0 4px 12px rgba(15, 23, 42, .06); }
.stat-label { color: var(--slate-500); font-weight: 500; margin: 0; font-size: .875rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; margin: 4px 0 0; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; }
.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.green { background: #ecfdf5; color: #059669; }
.stat-icon.amber { background: #fffbeb; color: #d97706; }
.stat-icon.slate { background: var(--slate-100); color: var(--slate-600); }

.alert-row, .search-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px; color: var(--slate-700); }
.alert-row:hover, .search-row:hover { background: var(--slate-50); color: var(--slate-900); }
.search-row { padding: 14px 20px; border-bottom: 1px solid var(--slate-100); border-radius: 0; }
.search-row:last-child { border-bottom: 0; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.alert-dot.warning { background: #f59e0b; }
.alert-dot.danger { background: #dc2626; }
.search-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--slate-100); color: var(--slate-600); display: inline-flex; align-items: center; justify-content: center; }

.timeline { display: flex; flex-direction: column; gap: 16px; }
.timeline-item { display: flex; gap: 12px; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--slate-300); margin-top: 6px; flex-shrink: 0; }

/* Auth */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; position: relative; }
.auth-lang { position: absolute; top: 16px; right: 16px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--slate-200); border-radius: 16px; padding: 32px; box-shadow: 0 10px 30px rgba(15, 23, 42, .05); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--slate-900); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.brand-name { font-weight: 700; margin: 0; font-size: 1.1rem; }
.brand-tagline { margin: 0; color: var(--slate-500); font-size: .8rem; }
.auth-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 16px; }

.flatpickr-input[readonly] { background: #fff; }
