/* ======= VARIABLES & RESET ======= */
:root {
  --bg: #0f1117;
  --bg2: #161820;
  --bg3: #1e2030;
  --bg4: #252840;
  --surface: #1a1d2e;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --accent: #6c63ff;
  --accent2: #a78bfa;
  --accent-glow: rgba(108,99,255,0.25);
  --green: #10d9a0;
  --green-bg: rgba(16,217,160,0.12);
  --red: #ff5f7a;
  --red-bg: rgba(255,95,122,0.12);
  --amber: #f59e0b;
  --amber-bg: rgba(245,158,11,0.12);
  --blue: #38bdf8;
  --blue-bg: rgba(56,189,248,0.12);
  --text: #eef0f8;
  --text2: #8891b0;
  --text3: #555d7a;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 8px 40px rgba(0,0,0,0.5);
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
input, select, textarea, button { font-family: inherit; }
button { cursor: pointer; border: none; background: none; }
input, select, textarea {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  width: 100%;
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
select option { background: var(--bg3); }
textarea { resize: vertical; }
canvas { display: block; width: 100% !important; }

/* ======= SPLASH ======= */
#splash {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; z-index: 9999;
  transition: opacity 0.5s, transform 0.5s;
}
#splash.out { opacity: 0; transform: scale(1.05); pointer-events: none; }
.splash-logo {
  display: flex; align-items: center; gap: 14px;
  animation: fadeUp 0.6s ease both;
}
.logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: 0 8px 32px var(--accent-glow);
}
.logo-icon svg { width: 30px; height: 30px; }
.logo-icon.sm { width: 36px; height: 36px; border-radius: 10px; }
.logo-icon.sm svg { width: 20px; height: 20px; }
.logo-text {
  font-size: 24px; font-weight: 700; color: var(--text);
  letter-spacing: -0.5px;
}
.logo-text em { font-style: normal; color: var(--accent2); }
.splash-tagline {
  font-size: 14px; color: var(--text2);
  animation: fadeUp 0.6s 0.15s ease both;
}
.splash-loader {
  width: 180px; height: 3px;
  background: var(--bg3); border-radius: 2px; overflow: hidden;
  animation: fadeUp 0.6s 0.3s ease both;
}
.loader-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
  animation: loadBar 1.8s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes loadBar { to { width: 100%; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(0.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ======= UTILITIES ======= */
.hidden { display: none !important; }
.mt { margin-top: 20px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }

/* ======= LOGIN ======= */
#login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fadeIn 0.5s ease;
}
.login-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(108,99,255,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(167,139,250,0.1) 0%, transparent 50%),
              var(--bg);
}
.login-card {
  position: relative; z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%; max-width: 400px;
  margin: 20px;
  box-shadow: var(--shadow);
  animation: pop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.login-sub { color: var(--text2); font-size: 14px; margin-bottom: 28px; }
.login-hint { text-align: center; font-size: 12px; color: var(--text3); margin-top: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }

/* ======= BUTTONS ======= */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: white; border-radius: var(--radius-sm);
  padding: 10px 20px; font-size: 14px; font-weight: 600;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 20px var(--accent-glow);
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 28px var(--accent-glow); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary.full { width: 100%; text-align: center; display: block; }
.btn-ghost {
  background: var(--bg3); color: var(--text2); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 10px 20px; font-size: 14px; font-weight: 500;
  transition: all var(--transition);
}
.btn-ghost:hover { background: var(--bg4); color: var(--text); }
.btn-sm {
  background: var(--bg3); color: var(--text2); border: 1px solid var(--border2);
  border-radius: 6px; padding: 6px 14px; font-size: 13px; font-weight: 500;
  transition: all var(--transition);
}
.btn-sm:hover { background: var(--bg4); color: var(--text); }
.btn-icon {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); font-size: 16px; transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg4); color: var(--text); }
.btn-logout {
  display: flex; align-items: center; gap: 8px;
  color: var(--red); font-size: 14px; font-weight: 500;
  padding: 12px 20px; border-radius: var(--radius-sm);
  transition: background var(--transition);
  margin: 8px 12px 12px;
}
.btn-logout:hover { background: var(--red-bg); }
.btn-logout svg { width: 16px; height: 16px; }

/* ======= LAYOUT ======= */
#main-app { display: flex; min-height: 100vh; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform var(--transition);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white; flex-shrink: 0;
}
.user-name { font-size: 14px; font-weight: 600; }
.user-role { font-size: 12px; color: var(--text2); }

.nav-links { list-style: none; flex: 1; padding: 0 12px; overflow-y: auto; }
.nav-links li { margin-bottom: 4px; }
.nav-links a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text2); font-size: 14px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: all var(--transition);
}
.nav-links a:hover { background: var(--bg3); color: var(--text); }
.nav-links a.active { background: var(--accent-glow); color: var(--accent2); }
.nav-links a svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Content */
#content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
#topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: rgba(15,17,23,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
}
#page-title { font-size: 18px; font-weight: 700; flex: 1; }
.menu-btn {
  display: none; flex-direction: column; gap: 5px;
  width: 36px; height: 36px; align-items: center; justify-content: center;
  border-radius: 8px; transition: background var(--transition);
}
.menu-btn:hover { background: var(--bg3); }
.menu-btn span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: all var(--transition); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.notif-btn {
  position: relative; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); transition: all var(--transition);
}
.notif-btn:hover { background: var(--bg4); color: var(--text); }
.notif-btn svg { width: 18px; height: 18px; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--red); color: white;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  display: none;
}

/* Pages */
#pages { flex: 1; padding: 24px; }
.page { animation: fadeUp 0.4s ease; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: fadeUp 0.5s ease both;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
}
.stat-card.green::before { background: linear-gradient(90deg, var(--green), transparent); }
.stat-card.red::before { background: linear-gradient(90deg, var(--red), transparent); }
.stat-card.amber::before { background: linear-gradient(90deg, var(--amber), transparent); }
.stat-card.blue::before { background: linear-gradient(90deg, var(--blue), transparent); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--accent), transparent); }
.stat-icon {
  width: 42px; height: 42px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px; font-size: 20px;
}
.stat-icon.green { background: var(--green-bg); }
.stat-icon.red { background: var(--red-bg); }
.stat-icon.amber { background: var(--amber-bg); }
.stat-icon.blue { background: var(--blue-bg); }
.stat-icon.purple { background: var(--accent-glow); }
.stat-label { font-size: 12px; color: var(--text2); font-weight: 500; letter-spacing: 0.3px; }
.stat-value { font-size: 26px; font-weight: 700; margin: 4px 0; font-family: 'JetBrains Mono', monospace; letter-spacing: -1px; }
.stat-sub { font-size: 12px; color: var(--text3); }
.stat-change { font-size: 12px; margin-top: 4px; font-weight: 500; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px; margin-bottom: 20px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  animation: fadeUp 0.5s ease both;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-header select {
  width: auto; padding: 6px 10px; font-size: 13px;
  background: var(--bg3);
}

/* Page actions */
.page-actions {
  display: flex; gap: 12px; margin-bottom: 20px;
  flex-wrap: wrap; align-items: center;
}
.search-input { max-width: 320px; }
.filter-bar {
  display: flex; gap: 8px; margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 6px 16px; border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--bg3); color: var(--text2);
  font-size: 13px; font-weight: 500;
  transition: all var(--transition); cursor: pointer;
}
.filter-chip.active { background: var(--accent-glow); color: var(--accent2); border-color: var(--accent); }
.filter-chip:hover { background: var(--bg4); color: var(--text); }

/* Properties */
.properties-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.prop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: fadeUp 0.4s ease both;
}
.prop-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.prop-card-header {
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--bg3), var(--bg4));
  display: flex; align-items: flex-start; justify-content: space-between;
}
.prop-type-badge {
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
  padding: 3px 10px; border-radius: 20px; text-transform: uppercase;
}
.prop-type-badge.flat { background: var(--blue-bg); color: var(--blue); }
.prop-type-badge.room { background: var(--green-bg); color: var(--green); }
.prop-type-badge.partition { background: var(--amber-bg); color: var(--amber); }
.prop-type-badge.villa { background: var(--accent-glow); color: var(--accent2); }
.prop-type-badge.office { background: var(--red-bg); color: var(--red); }
.prop-card-body { padding: 16px 18px; }
.prop-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.prop-building { font-size: 13px; color: var(--text2); margin-bottom: 14px; }
.prop-stat-row { display: flex; gap: 12px; margin-bottom: 14px; }
.prop-stat { flex: 1; }
.prop-stat-label { font-size: 11px; color: var(--text3); font-weight: 500; }
.prop-stat-val { font-size: 15px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.prop-stat-val.green { color: var(--green); }
.prop-tenant-info {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.prop-tenant-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-glow); color: var(--accent2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.prop-tenant-name { font-size: 13px; font-weight: 600; }
.prop-tenant-sub { font-size: 11px; color: var(--text2); }
.prop-vacant {
  background: var(--bg3); border-radius: var(--radius-sm);
  padding: 10px 12px; text-align: center;
  font-size: 13px; color: var(--text3);
}
.prop-card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* Tenants */
#tenants-list, #payments-list, #expenses-list, #users-list { display: flex; flex-direction: column; gap: 12px; }
.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  transition: all var(--transition);
  animation: slideIn 0.3s ease both;
}
.list-item:hover { border-color: var(--border2); background: var(--bg3); }
.list-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.list-info { flex: 1; min-width: 0; }
.list-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.list-sub { font-size: 13px; color: var(--text2); }
.list-sub span { margin-right: 10px; }
.list-amount {
  text-align: right; flex-shrink: 0;
}
.list-amount .amount { font-size: 16px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.list-amount .amount-sub { font-size: 12px; color: var(--text2); }
.list-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Status badges */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
}
.badge.paid { background: var(--green-bg); color: var(--green); }
.badge.pending { background: var(--amber-bg); color: var(--amber); }
.badge.overdue { background: var(--red-bg); color: var(--red); }
.badge.partial { background: var(--blue-bg); color: var(--blue); }
.badge.vacant { background: var(--bg3); color: var(--text3); }
.badge.active { background: var(--green-bg); color: var(--green); }

/* Payments */
.pay-total-preview {
  background: var(--bg3); border-radius: var(--radius-sm);
  padding: 14px; margin-top: 8px;
  border: 1px solid var(--border2);
}
.pay-total-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; color: var(--text2); }
.pay-total-row.total { font-size: 16px; font-weight: 700; color: var(--text); border-top: 1px solid var(--border2); padding-top: 8px; margin-top: 8px; margin-bottom: 0; }

/* Reports */
.reports-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 20px; margin-bottom: 20px;
}
#report-summary { display: flex; flex-direction: column; gap: 10px; }
.report-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.report-row:last-child { border-bottom: none; }
.report-row-label { font-size: 14px; color: var(--text2); }
.report-row-val { font-size: 15px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }

/* Property Performance */
#property-performance { display: flex; flex-direction: column; gap: 10px; }
.perf-row {
  display: grid; grid-template-columns: 200px 1fr auto;
  align-items: center; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.perf-row:last-child { border-bottom: none; }
.perf-bar-wrap { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.perf-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 3px; transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }
.perf-val { font-size: 14px; font-weight: 700; font-family: 'JetBrains Mono', monospace; white-space: nowrap; min-width: 80px; text-align: right; }

/* My Unit */
#myunit-content .unit-hero {
  background: linear-gradient(135deg, var(--bg3), var(--bg4));
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 28px; margin-bottom: 20px;
}
.unit-hero-name { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.unit-hero-sub { color: var(--text2); font-size: 14px; margin-bottom: 20px; }
.unit-amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.unit-amount-card { background: var(--bg); border-radius: var(--radius-sm); padding: 14px; }
.unit-amount-label { font-size: 12px; color: var(--text3); margin-bottom: 4px; }
.unit-amount-val { font-size: 20px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }

/* Recent Payments */
.recent-pay-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.recent-pay-item:last-child { border-bottom: none; }
.recent-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.recent-pay-name { flex: 1; font-size: 14px; font-weight: 500; }
.recent-pay-date { font-size: 12px; color: var(--text2); }
.recent-pay-amount { font-size: 14px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--green); }

/* Overdue */
.overdue-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; border-radius: var(--radius-sm);
  background: var(--red-bg); border: 1px solid rgba(255,95,122,0.2);
  margin-bottom: 8px; animation: slideIn 0.3s ease;
}
.overdue-item:last-child { margin-bottom: 0; }
.overdue-days {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--red); color: white;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.overdue-days small { font-size: 9px; font-weight: 500; opacity: 0.8; }
.overdue-info { flex: 1; }
.overdue-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.overdue-unit { font-size: 12px; color: var(--text2); }
.overdue-amount { font-size: 15px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--red); }

/* Admin */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-form { display: flex; flex-direction: column; gap: 14px; }

/* Modals */
.modal {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 500;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.modal.open { transform: translateY(0); }
.modal-header {
  position: sticky; top: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-header button {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg3); color: var(--text2);
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.modal-header button:hover { background: var(--bg4); color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  position: sticky; bottom: 0;
  padding: 16px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Side Panel */
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 340px; background: var(--surface);
  border-left: 1px solid var(--border2);
  z-index: 500;
  transform: translateX(100%);
  transition: transform var(--transition);
}
.side-panel.open { transform: translateX(0); }
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.panel-header h3 { font-size: 16px; font-weight: 700; }
.panel-header button {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg3); color: var(--text2);
  display: flex; align-items: center; justify-content: center; transition: all var(--transition);
}
.panel-header button:hover { background: var(--bg4); }
#notif-list { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.notif-item {
  background: var(--bg3); border-radius: var(--radius-sm);
  padding: 12px; border-left: 3px solid;
  animation: slideIn 0.3s ease;
}
.notif-item.warning { border-color: var(--amber); }
.notif-item.danger { border-color: var(--red); }
.notif-item.info { border-color: var(--blue); }
.notif-item.success { border-color: var(--green); }
.notif-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.notif-desc { font-size: 12px; color: var(--text2); }

/* Overlay */
#overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 400;
  animation: fadeIn 0.2s ease;
}

/* Toast */
#toast-container {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  z-index: 9000; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg4); border: 1px solid var(--border2);
  border-radius: 30px; padding: 10px 20px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  animation: fadeUp 0.3s ease;
  pointer-events: all;
  white-space: nowrap;
}
.toast.success { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.toast.error { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.toast.info { background: var(--blue-bg); border-color: var(--blue); color: var(--blue); }

/* Bottom Nav */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(22,24,32,0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 200;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  display: flex; justify-content: space-around;
}
.bn-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  color: var(--text3); font-size: 11px; font-weight: 500;
  cursor: pointer; transition: color var(--transition);
  min-width: 56px;
}
.bn-item.active { color: var(--accent2); }
.bn-item svg { width: 22px; height: 22px; }
.bn-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent); margin: 0 auto;
  opacity: 0; transition: opacity var(--transition);
}
.bn-item.active .bn-dot { opacity: 1; }

/* Notification count */
.notif-badge { display: none; }
.notif-badge.show { display: flex; }

/* Empty state */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text3);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ====== RESPONSIVE ====== */
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow);
  }
  #sidebar.open { transform: translateX(0); }
  #content { margin-left: 0; }
  .menu-btn { display: flex; }
  #bottom-nav { display: flex; }
  #pages { padding: 16px; padding-bottom: 90px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .perf-row { grid-template-columns: 120px 1fr auto; }
  .unit-amounts { grid-template-columns: 1fr 1fr; }
  .side-panel { width: 100%; }
  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .unit-amounts { grid-template-columns: 1fr; }
  .properties-grid { grid-template-columns: 1fr; }
  .page-actions { flex-direction: column; align-items: stretch; }
  .search-input { max-width: 100%; }
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* PWA status bar padding */
@supports (padding-top: env(safe-area-inset-top)) {
  #topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  #sidebar { padding-top: env(safe-area-inset-top); }
}
