:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --sidebar-w: 220px;
  --header-h: 56px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
       background: var(--gray-100); color: var(--gray-900); font-size: 14px; }

/* ===== LOGIN ===== */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
}
.login-box {
  background: white; border-radius: 12px; padding: 40px;
  width: 360px; box-shadow: var(--shadow-lg);
}
.login-box h1 { font-size: 22px; margin-bottom: 8px; color: var(--gray-900); }
.login-box p { color: var(--gray-500); margin-bottom: 28px; font-size: 13px; }
.login-logo { font-size: 40px; text-align: center; margin-bottom: 16px; }

/* ===== LAYOUT ===== */
#app { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w); background: #1e293b; color: white;
  display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto;
}
.sidebar-brand {
  padding: 18px 20px; font-size: 15px; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-brand .icon { font-size: 22px; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; cursor: pointer; color: #94a3b8;
  transition: all .15s; font-size: 13.5px; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { background: rgba(37,99,235,.2); color: white; border-left-color: var(--primary); }
.nav-item .icon { font-size: 17px; width: 20px; text-align: center; }
.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px; color: #64748b;
}

/* MAIN */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: var(--header-h); background: white; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--gray-900); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
label { display: block; font-size: 12px; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--gray-300);
  border-radius: 6px; font-size: 14px; color: var(--gray-900);
  background: white; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--gray-500); margin-top: 3px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent; transition: all .15s; text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; color: var(--gray-700); border-color: var(--gray-200); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; }

/* ===== CARDS ===== */
.card {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: white; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--gray-200);
}
.stat-card .label { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.stat-card .value { font-size: 26px; font-weight: 700; color: var(--gray-900); }
.stat-card .sub { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.stat-card .icon { font-size: 28px; float: right; margin-top: -4px; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 14px; text-align: left; font-size: 11px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  color: var(--gray-500); background: var(--gray-50); border-bottom: 1px solid var(--gray-200);
}
td { padding: 11px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr:hover td { background: var(--gray-50); }
tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-green { background: #dcfce7; color: #15803d; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto; z-index: 1000;
}
.modal {
  background: white; border-radius: 10px; width: 100%; max-width: 680px;
  box-shadow: var(--shadow-lg); animation: slideIn .2s ease;
}
.modal-lg { max-width: 900px; }
.modal-header {
  padding: 18px 24px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
.close-btn {
  background: none; border: none; font-size: 20px; cursor: pointer;
  color: var(--gray-500); padding: 4px; border-radius: 4px;
}
.close-btn:hover { background: var(--gray-100); }
@keyframes slideIn { from { opacity:0; transform:translateY(-16px); } to { opacity:1; transform:none; } }

/* ===== SEARCH BAR ===== */
.search-bar {
  display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap;
}
.search-bar input { max-width: 280px; }
.search-bar select { max-width: 180px; }

/* ===== PROPERTY COLOR DOT ===== */
.color-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}

/* ===== CALENDAR ===== */
.calendar-grid {
  display: grid; background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--gray-200); overflow: auto;
}
.cal-header-row, .cal-prop-row { display: flex; }
.cal-label {
  width: 160px; flex-shrink: 0; padding: 8px 12px; font-weight: 600;
  font-size: 12px; background: var(--gray-50); border-right: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; gap: 6px;
}
.cal-days-header { display: flex; flex: 1; border-bottom: 1px solid var(--gray-200); }
.cal-day-cell {
  flex: 1; min-width: 28px; padding: 4px 2px; text-align: center;
  font-size: 11px; color: var(--gray-500); border-right: 1px solid var(--gray-100);
  background: var(--gray-50);
}
.cal-day-cell.today { background: #eff6ff; color: var(--primary); font-weight: 700; }
.cal-day-cell.weekend { background: #fafaf9; }
.cal-row-cells { display: flex; flex: 1; position: relative; }
.cal-cell {
  flex: 1; min-width: 28px; height: 32px; border-right: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-200); position: relative; cursor: pointer;
}
.cal-cell:hover { background: var(--primary-light); }
.cal-cell.booked { background: rgba(37,99,235,.1); }
.cal-booking-bar {
  position: absolute; top: 4px; left: 1px; right: 1px; height: 24px;
  border-radius: 4px; opacity: .85; display: flex; align-items: center;
  padding: 0 6px; font-size: 11px; color: white; font-weight: 500;
  white-space: nowrap; overflow: hidden; cursor: pointer; z-index: 2;
}
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-month-title { font-size: 15px; font-weight: 600; min-width: 140px; text-align: center; }

/* ===== IMAGE UPLOAD ===== */
.image-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.image-thumb {
  width: 80px; height: 80px; object-fit: cover; border-radius: 6px;
  border: 2px solid var(--gray-200); cursor: pointer;
}
.image-thumb:hover { border-color: var(--danger); }
.upload-area {
  border: 2px dashed var(--gray-300); border-radius: 8px;
  padding: 20px; text-align: center; cursor: pointer; color: var(--gray-500);
  font-size: 13px; transition: all .15s;
}
.upload-area:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ===== ALERTS ===== */
.alert {
  padding: 12px 16px; border-radius: 6px; font-size: 13px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ===== TOAST ===== */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 18px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow-lg); animation: toastIn .2s ease;
  display: flex; align-items: center; gap: 8px; max-width: 340px;
}
.toast-success { background: #15803d; color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--primary); color: white; }
@keyframes toastIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }

/* ===== MISC ===== */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--gray-500);
}
.empty-state .icon { font-size: 40px; margin-bottom: 8px; }
.empty-state p { font-size: 13px; }
.section-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--gray-200); }
.flex { display: flex; } .gap-2 { gap: 8px; } .gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; } .mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; } .text-gray { color: var(--gray-500); }
.text-right { text-align: right; }
.font-bold { font-weight: 600; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.color-picker-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: border-color .1s;
}
.color-swatch.selected { border-color: var(--gray-700); }
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .sidebar { width: 56px; }
  .nav-item span { display: none; }
  .sidebar-brand .brand-name { display: none; }
}
