/* ==========================================
   FLIPTRACK — CORE STYLESHEET (v3 Cache Bust)
   Modern Slate Palette, Inter & Outfit Fonts
   ========================================== */

:root {
  /* Fonts */
  --font-head: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'DM Mono', monospace;

  /* Dark Theme Colors (Default) */
  --bg: #0b0f19;
  --surface: #111827;
  --surface2: #1f2937;
  --surface3: #374151;
  --border: #1f2937;
  --border2: #374151;
  
  --accent: #6366f1;       /* Indigo */
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent2: #f97316;      /* Amber */
  
  --text: #f9fafb;
  --text2: #d1d5db;
  --muted: #9ca3af;
  
  --danger: #ef4444;
  --success: #10b981;
  --info: #3b82f6;
  --purple: #8b5cf6;
  
  --radius: 12px;
  --radius-sm: 8px;
  
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 12px rgba(99, 102, 241, 0.15);
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  /* Light Theme Colors */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --surface3: #e2e8f0;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  
  --accent: #4f46e5;       /* Deeper Indigo */
  --accent-light: #6366f1;
  --accent-glow: rgba(79, 70, 229, 0.15);
  --accent2: #ea580c;      /* Deeper Amber */
  
  --text: #0f172a;
  --text2: #334155;
  --muted: #64748b;
  
  --danger: #dc2626;
  --success: #16a34a;
  --info: #2563eb;
  --purple: #7c3aed;
  
  --shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.05), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 12px rgba(79, 70, 229, 0.08);
}

/* Global Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Typography Overrides */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  color: var(--text);
  font-weight: 600;
}

/* ====== THEME TOGGLE ====== */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
  padding: 0;
  line-height: 1;
}
.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--surface3);
  transform: scale(1.05);
}

/* ====== AUTH SCREEN ====== */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 20px;
}
.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.auth-logo {
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -1px;
  margin-bottom: 4px;
  text-align: center;
}
.auth-tagline {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 32px;
  text-align: center;
}
.auth-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}
.auth-switch {
  font-size: 12px;
  color: var(--muted);
  margin-top: 18px;
  text-align: center;
}
.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}
.auth-switch a:hover {
  color: var(--accent-light);
  text-decoration: underline;
}
.auth-error {
  font-size: 11px;
  color: var(--danger);
  min-height: 18px;
  margin-bottom: 12px;
}

/* ====== TOP NAV ====== */
.topnav {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.topnav-left {
  display: flex;
  align-items: center;
  gap: 28px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}
.topnav-left::-webkit-scrollbar {
  display: none; /* Safari/Chrome */
}
.topnav-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.nav-logo {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  margin-right: 12px;
  flex-shrink: 0;
}
.nav-link {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  flex-shrink: 0;
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--surface2);
}

@media (max-width: 1200px) {
  .topnav-left {
    gap: 12px;
  }
  .nav-link {
    font-size: 12px;
    padding: 6px 8px;
  }
}
@media (max-width: 768px) {
  .topnav-left {
    gap: 8px;
  }
  .nav-link {
    font-size: 11px;
    padding: 4px 6px;
  }
}
.nav-user {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
}

/* ====== LAYOUT & SECTIONS ====== */
.page-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 32px 64px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.mt-20 { margin-top: 20px; }
.mt-16 { margin-top: 16px; }

/* ====== STATS GRID ====== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border2);
}
.stat-label {
  font-family: var(--font-head);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.stat-value {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}
.stat-value.yellow { color: var(--accent); }
.stat-value.orange { color: var(--accent2); }
.stat-value.red { color: var(--danger); }
.stat-value.green { color: var(--success); }
.stat-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

/* ====== CARDS ====== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card:hover {
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.card-title {
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.card-body {
  padding: 20px;
}
.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ====== CARD COVER IMAGES (All Projects Card Grid) ====== */
.card-cover {
  height: 160px;
  width: 100%;
  overflow: hidden;
  position: relative;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:hover .card-cover img {
  transform: scale(1.05);
}
.card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--surface2) 0%, var(--surface3) 100%);
  color: var(--muted);
  font-size: 32px;
}
.card-cover-placeholder::after {
  content: "🏠";
}

/* ====== TABLES ====== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  font-family: var(--font-head);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}
.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr {
  transition: var(--transition);
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}
.data-table tbody tr:hover td {
  background: var(--surface2);
}

/* Project Info layout inside Table Cells */
.table-project-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.proj-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface3);
}
.proj-thumb-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  color: var(--muted);
}
.proj-name {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}
.proj-addr {
  font-size: 11px;
  color: var(--muted);
}

/* Table Text Colors */
.text-orange { color: var(--accent2); font-family: var(--font-head); font-weight: 600; }
.text-red { color: var(--danger); font-family: var(--font-head); font-weight: 600; }
.text-green { color: var(--success); font-family: var(--font-head); font-weight: 600; }

/* ====== PROGRESS BARS ====== */
.pct-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pct-bar {
  flex: 1;
  height: 6px;
  background: var(--surface3);
  border-radius: 4px;
  overflow: hidden;
  min-width: 60px;
}
.pct-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease-in-out;
}
.pct-label {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
  min-width: 32px;
}

/* ====== BADGES ====== */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
}
.badge-active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  border-color: rgba(99, 102, 241, 0.2);
}
.badge-warning {
  background: rgba(249, 115, 22, 0.12);
  color: var(--accent2);
  border-color: rgba(249, 115, 22, 0.2);
}
.badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}
.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

/* ====== FORM & INPUT FIELDS ====== */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  font-family: var(--font-head);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
  font-weight: 600;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  transition: var(--transition);
  outline: none;
}
.form-input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}
textarea.form-input {
  resize: vertical;
  min-height: 80px;
}
select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ====== BUTTONS ====== */
.btn-primary {
  padding: 10px 20px;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  padding: 10px 18px;
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-secondary:hover {
  border-color: var(--border2);
  background: var(--surface3);
}

.btn-ghost {
  padding: 8px 14px;
  background: transparent;
  color: var(--text2);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}

.btn-danger {
  padding: 8px 16px;
  background: transparent;
  color: var(--danger);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

.icon-btn {
  padding: 6px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.w-full { width: 100%; }

/* ====== MODALS & OVERLAYS ====== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease-out;
}
.modal-overlay.open {
  display: flex;
  opacity: 1;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.open .modal {
  transform: scale(1);
}
.modal-sm { max-width: 440px; }
.modal-lg { max-width: 720px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: var(--transition);
}
.modal-close:hover {
  color: var(--text);
  transform: scale(1.1);
}
.modal-body {
  padding: 12px 24px 20px;
}
.modal-footer {
  padding: 0 24px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.modal form {
  padding: 0 24px;
}
.modal .form-group {
  margin-top: 16px;
}

/* ====== ADDRESS AUTOCOMPLETE DROPDOWN ====== */
.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px);
  animation: slideDownFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideDownFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.autocomplete-suggestion {
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 12px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.autocomplete-suggestion:last-child {
  border-bottom: none;
}
.autocomplete-suggestion:hover,
.autocomplete-suggestion.active {
  background: var(--surface2);
  color: var(--text);
}

/* ====== NAVIGATION TABS ====== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  background: var(--surface);
}
.tab-btn {
  padding: 14px 20px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: -1px;
}
.tab-btn:hover {
  color: var(--text2);
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab-content {
  display: none;
  padding: 24px 32px;
}
.tab-content.active {
  display: block;
}

/* ====== SEARCH LAYOUT ====== */
.search-wrap {
  display: flex;
  align-items: center;
}
.search-input {
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  outline: none;
  width: 240px;
  transition: var(--transition);
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

/* ====== STATE FEEDBACK ====== */
.loading-state {
  padding: 48px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 13px;
}
.empty-state {
  padding: 56px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.empty-icon {
  font-size: 40px;
  margin-bottom: 16px;
}
.empty-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}
.empty-sub {
  font-size: 13px;
  color: var(--muted);
}

/* ====== TOAST NOTIFICATION ====== */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 9999;
  box-shadow: var(--shadow);
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.toast-success {
  background: var(--surface);
  border: 1px solid var(--success);
  color: var(--success);
}
.toast-error {
  background: var(--surface);
  border: 1px solid var(--danger);
  color: var(--danger);
}

/* ====== PROJECT DETAIL PAGE ====== */
.project-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.project-header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}
.back-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  padding: 0;
}
.back-btn:hover {
  color: var(--text);
}
.project-name-head {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
}
.project-addr-head {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

/* Category Pills */
.cat-pill {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Expense details */
.exp-note {
  font-size: 11px;
  color: var(--info);
  font-style: italic;
  margin-top: 3px;
  cursor: pointer;
}
.exp-amount-cell {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.del-btn {
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
}
.del-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Budget allocation bars */
.bcat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.bcat-row:last-child {
  margin-bottom: 0;
}
.bcat-label {
  width: 110px;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}
.bcat-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--surface3);
  border-radius: 4px;
  overflow: hidden;
}
.bcat-bar-fill {
  height: 100%;
  border-radius: 4px;
}
.bcat-amounts {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
  min-width: 140px;
  text-align: right;
}

/* Payment categories methods */
.pay-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.pay-row:last-child {
  border-bottom: none;
}
.pay-method {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pay-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.pay-amount {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
}
.pay-count {
  font-size: 11px;
  color: var(--muted);
}

/* Quick overview grids */
.overview-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.overview-row:last-child {
  border-bottom: none;
}
.overview-label {
  color: var(--muted);
}
.overview-val {
  font-weight: 500;
}
.overview-val.yellow { color: var(--accent); }
.overview-val.orange { color: var(--accent2); }
.overview-val.green { color: var(--success); }
.overview-val.red { color: var(--danger); }

/* Category budgets editor input */
.bedit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.bedit-label {
  width: 120px;
  font-size: 13px;
  flex-shrink: 0;
}
.bedit-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.bedit-input:focus {
  border-color: var(--accent);
}
.bedit-spent {
  font-size: 11px;
  color: var(--muted);
  width: 90px;
  text-align: right;
  white-space: nowrap;
}

/* Exports drop wrapper */
.dropdown-wrap {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 6px;
  z-index: 50;
  min-width: 180px;
  display: none;
  box-shadow: var(--shadow);
  transform: translateY(-8px);
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
}
.dropdown-menu.open {
  display: block;
  transform: translateY(0);
  opacity: 1;
}
.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--text2);
  font-family: var(--font-head);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  border-radius: 6px;
  transition: var(--transition);
}
.dropdown-item:hover {
  background: var(--surface2);
  color: var(--text);
}

/* Tasks elements */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.task-item:last-child {
  border-bottom: none;
}
.task-check {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border2);
  border-radius: 4px;
  margin-top: 1px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: var(--transition);
}
.task-check.done {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}
.task-text {
  flex: 1;
  font-size: 13px;
}
.task-text.done-text {
  text-decoration: line-through;
  color: var(--muted);
}
.task-due {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* Photos panel grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.photo-thumb {
  aspect-ratio: 1.5;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}
.photo-thumb:hover img {
  transform: scale(1.03);
}
.photo-thumb:hover .photo-del {
  opacity: 1;
}
.photo-del {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(11, 15, 25, 0.85);
  border: none;
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}
.photo-star {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(11, 15, 25, 0.85);
  border: none;
  color: #b3b9c9;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, transform 0.2s;
}
.photo-star.active {
  color: #ffb800;
}
.photo-star:hover {
  transform: scale(1.1);
}
.photo-thumb:hover .photo-star,
.photo-star.active {
  opacity: 1;
}
.photo-thumb.is-cover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 99, 102, 241), 0.3);
}

/* Schedule milestones list */
.milestone-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.milestone-item:last-child {
  border-bottom: none;
}
.milestone-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.milestone-content {
  flex: 1;
}
.milestone-name {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
}
.milestone-dates {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.milestone-status {
  font-size: 11px;
}

/* ====== WEB RESPONSIVE LAYOUTS ====== */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .page-wrap {
    padding: 24px 20px 48px;
  }
  .topnav {
    padding: 0 20px;
  }
  .form-row, .form-row-3 {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .topnav-left {
    gap: 8px;
  }
}

/* ====== SCROLLBAR CUSTOMIZATION ====== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 4px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ====== SYNC ANIMATION & STYLE ====== */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.syncing {
  display: inline-block;
  animation: spin 1.2s linear infinite;
  pointer-events: none;
  opacity: 0.7;
}
.sync-zillow-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  transition: transform 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sync-zillow-btn:hover {
  transform: scale(1.15);
}

/* ====== DROPDOWNS & BULK ACTIONS ====== */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 100;
  min-width: 150px;
  padding: 4px 0;
}
.dropdown-item {
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  transition: background 0.2s;
}
.dropdown-item:hover {
  background: var(--surface2);
}

/* Checkbox overlays on cards */
.project-card-checkbox-container {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 20;
  background: rgba(17, 24, 39, 0.55);
  border-radius: 6px;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: opacity 0.2s ease, background 0.2s ease;
}
.project-card-checkbox-container:hover {
  background: rgba(17, 24, 39, 0.8);
  border-color: var(--accent);
}
.project-card-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
  margin: 0;
  display: block;
}

/* ====== PREMIUM EXPENSE & BUDGET REDESIGN ====== */
.budget-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 768px) {
  .budget-stats-grid {
    grid-template-columns: 1fr;
  }
}
.budget-table {
  width: 100%;
  border-collapse: collapse;
}
.budget-table th, .budget-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.budget-table th {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--surface2);
  border-bottom: 2px solid var(--border);
}
.budget-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.015);
}
.budget-variance {
  font-family: var(--font-head);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.budget-variance.positive {
  color: var(--success);
}
.budget-variance.negative {
  color: var(--danger);
}
.budget-progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
}
.budget-progress-pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  min-width: 35px;
  text-align: right;
}
.expense-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}
.expense-search-wrap {
  position: relative;
  flex: 1;
  max-width: 360px;
}
.expense-search-input {
  width: 100%;
  padding: 10px 16px 10px 36px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: var(--transition);
}
.expense-search-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  background: var(--surface3);
}
.expense-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}
.expense-filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.expense-filter-tab {
  padding: 6px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text2);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}
.expense-filter-tab:hover {
  border-color: var(--border2);
  color: var(--text);
  background: var(--surface3);
}
.expense-filter-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.expense-tab-badge {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
  padding: 1px 5px;
  border-radius: 10px;
  font-weight: 600;
}
.expense-filter-tab.active .expense-tab-badge {
  background: rgba(0, 0, 0, 0.2);
}
.sortable-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: var(--transition);
}
.sortable-header:hover {
  color: var(--text) !important;
  background: var(--surface2) !important;
}
.sort-indicator {
  font-size: 10px;
  margin-left: 4px;
  opacity: 0.7;
}
.clickable-row {
  cursor: pointer;
  transition: var(--transition);
}
.clickable-row:hover {
  background: rgba(255, 255, 255, 0.025) !important;
}
.payment-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
  display: inline-block;
}
.payment-badge.cash { background: rgba(232, 197, 71, 0.1); color: #e8c547; border: 1px solid rgba(232, 197, 71, 0.2); }
.payment-badge.check { background: rgba(92, 184, 122, 0.1); color: #5cb87a; border: 1px solid rgba(92, 184, 122, 0.2); }
.payment-badge.credit-card { background: rgba(64, 150, 212, 0.1); color: #4096d4; border: 1px solid rgba(64, 150, 212, 0.2); }
.payment-badge.bank-transfer { background: rgba(155, 112, 212, 0.1); color: #9b70d4; border: 1px solid rgba(155, 112, 212, 0.2); }

.exp-vendor-title {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}
.exp-desc-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}


