*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #c0392b; --primary-dark: #96281b;
  --primary-light: #fdecea; --primary-xlight: #fff8f7; --primary-mid: rgba(192,57,43,0.12);
  --success: #2e7d32; --success-light: #e8f5e9;
  --warn: #e65100; --warn-light: #fff3e0;
  --bg: #f7f6f2; --surface: #ffffff; --surface-2: #f9f8f5; --surface-3: #f3f0ec;
  --text: #1a1a1a; --muted: #6b7280; --faint: #9ca3af;
  --border: rgba(0,0,0,0.1); --divider: rgba(0,0,0,0.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.09);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.13);
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px;
  --radius-xl: 16px; --radius-full: 9999px;
  --transition: 160ms cubic-bezier(0.16,1,0.3,1);
  --nav-h: 64px;
  --text-xs:   clamp(0.75rem, 0.7rem + 0.2vw, 0.8125rem);
  --text-sm:   clamp(0.8125rem, 0.78rem + 0.2vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --text-lg:   clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  --text-xl:   clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  --text-2xl:  clamp(1.375rem, 1.1rem + 1.4vw, 1.875rem);
  --space-1:4px;--space-2:8px;--space-3:12px;--space-4:16px;--space-5:20px;
  --space-6:24px;--space-8:32px;--space-10:40px;--space-12:48px;--space-16:64px;
}
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; scroll-behavior: smooth; }
body { min-height: 100dvh; font-family: 'Inter', system-ui, sans-serif;
       font-size: var(--text-base); color: var(--text); background: var(--bg); }
img, video, svg { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
.page { display: none; min-height: 100dvh; }

/* Auth Loading */
.auth-loading { position: fixed; inset: 0; z-index: 9999; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4); }
.al-icon { font-size: 52px; animation: bounce 1.2s ease infinite; }
.al-spin { width: 32px; height: 32px; border: 3px solid var(--primary-light);
  border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
.al-text { font-size: var(--text-sm); color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* Navbar */
.navbar { position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  background: rgba(255,255,255,0.95); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  padding: 0 var(--space-8); gap: var(--space-5); }
.nav-logo { display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-lg); font-weight: 800; color: var(--primary); flex-shrink: 0; }
.nav-logo-icon { width: 36px; height: 36px; background: var(--primary); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 18px; }
.nav-links { display: flex; align-items: center; gap: 2px; flex: 1; }
.nav-link { padding: 8px 12px; border-radius: var(--radius-md); font-size: var(--text-sm);
  font-weight: 500; color: var(--muted); transition: all var(--transition);
  display: flex; align-items: center; gap: var(--space-2); }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-badge { background: var(--primary); color: #fff; border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700; min-width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.nav-right { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.nav-list-btn { padding: 8px 16px; background: var(--primary); color: #fff;
  border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 600;
  transition: all var(--transition); }
.nav-list-btn:hover { background: var(--primary-dark); }
.nav-avatar-wrap { position: relative; }
.nav-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary);
  color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center;
  justify-content: center; cursor: pointer; border: 2px solid var(--primary-light);
  transition: all var(--transition); flex-shrink: 0; overflow: hidden; }
.nav-avatar:hover { border-color: var(--primary); }
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-dropdown { position: absolute; top: calc(100% + 8px); right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  min-width: 210px; padding: var(--space-2); display: none; z-index: 200; }
.nav-avatar-wrap.open .nav-dropdown { display: block; }
.nav-dropdown-header { padding: 8px 12px 6px; font-size: var(--text-xs); color: var(--muted); font-weight: 600; }
.nav-dropdown-divider { height: 1px; background: var(--divider); margin: 4px 0; }
.nav-dd-item { display: flex; align-items: center; gap: var(--space-2); padding: 8px 12px;
  border-radius: var(--radius-md); font-size: var(--text-sm); width: 100%;
  transition: background var(--transition); color: var(--text); }
.nav-dd-item:hover { background: var(--surface-3); }
.nav-dd-item.danger { color: #dc2626; }
@media (max-width: 768px) {
  .navbar { padding: 0 var(--space-4); gap: var(--space-3); }
  .nav-links { display: none; }
  .nav-list-btn .lbl { display: none; }
}

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: var(--space-6); box-shadow: var(--shadow-sm); }

/* Ad Zones */
.ad-zone { display: none; border-radius: var(--radius-lg); overflow: hidden; text-align: center; }
.ad-zone img { border-radius: var(--radius-lg); max-width: 100%; }
.ad-zone-wrap { padding: 12px 32px; background: var(--bg); }
@media(max-width:768px) { .ad-zone-wrap { padding: 8px 14px; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 8px 20px; border-radius: var(--radius-md); font-size: var(--text-sm);
  font-weight: 600; transition: all var(--transition); border: 1.5px solid transparent; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-full { width: 100%; }
.btn-lg { padding: 12px 24px; font-size: var(--text-base); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label { font-size: var(--text-sm); font-weight: 600; }
.form-input, .form-select, .form-textarea {
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); font-size: var(--text-base); color: var(--text);
  transition: border-color var(--transition); width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.08);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: var(--text-xs); color: var(--muted); }
.form-error { font-size: var(--text-xs); color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 4px 10px;
  border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 700; }
.badge-rent { background: #e3f2fd; color: #1565c0; }
.badge-buy  { background: #e8f5e9; color: #2e7d32; }
.badge-success { background: var(--success-light); color: var(--success); }

/* Empty State */
.empty-state { display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: var(--space-16) var(--space-8); }
.empty-icon { font-size: 52px; margin-bottom: var(--space-4); }
.empty-title { font-size: var(--text-xl); font-weight: 700; margin-bottom: var(--space-2); }
.empty-sub { font-size: var(--text-sm); color: var(--muted); max-width: 36ch; margin-bottom: var(--space-6); }

/* Skeleton */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: var(--radius-sm); }
.skeleton-text { height: 1em; margin-bottom: 8px; border-radius: 4px; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1a1a1a; color: #fff; padding: 12px 24px; border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: 500; opacity: 0; transition: all 0.3s;
  z-index: 9999; white-space: nowrap; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Checkbox grid */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-2); }
.check-item { display: flex; align-items: center; gap: var(--space-2); padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-md); cursor: pointer;
  font-size: var(--text-sm); transition: all var(--transition); }
.check-item:hover { border-color: var(--primary); background: var(--primary-xlight); }
.check-item input { width: 16px; height: 16px; accent-color: var(--primary); }
.check-item.checked { border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 600; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }