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

:root {
  --primary: #6366f1;
  --primary-light: #eef2ff;
  --primary-dark: #4338ca;
  --primary-rgb: 99,102,241;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-w: 230px;
  --topbar-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
}

body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f0f2f7; color: var(--gray-800); line-height: 1.5; }

/* ── UTILS ── */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; }
.fw-700 { font-weight: 700; }
.text-sm { font-size: 12.5px; }
.text-gray { color: var(--gray-500); }
.w-full { width: 100%; }
.loading { color: var(--gray-400); font-size: 14px; padding: 40px; text-align: center; }

/* ── AUTH SCREEN ── */
#auth-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-box {
  background: white; border-radius: 20px; box-shadow: var(--shadow-lg);
  padding: 40px; width: 100%; max-width: 420px;
}
.auth-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--gray-100);
}
.auth-logo h1 { font-size: 22px; font-weight: 800; color: var(--gray-900); }

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

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w);
  background: #1e1e2e;
  display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto;
}
.logo {
  display: flex; align-items: center; gap: 10px; padding: 20px 16px 16px;
  font-weight: 800; font-size: 15px; color: white;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
nav { padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.3);
  padding: 10px 12px 4px; margin-top: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  text-decoration: none; color: rgba(255,255,255,.55); font-size: 13.5px; font-weight: 500;
  transition: all .15s; cursor: pointer;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.nav-item.active { background: rgba(99,102,241,.3); color: #a5b4fc; }
.nav-item.active svg { color: #a5b4fc; }

.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-footer span { font-size: 13px; color: rgba(255,255,255,.5); font-weight: 500; }

/* ── MAIN ── */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#topbar {
  height: var(--topbar-h); background: white; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  flex-shrink: 0; box-shadow: 0 1px 0 var(--gray-200);
}
#section-title { font-size: 17px; font-weight: 700; color: var(--gray-900); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
#today-date { font-size: 12.5px; color: var(--gray-400); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; box-shadow: 0 2px 8px rgba(var(--primary-rgb),.4);
}
#content { flex: 1; overflow-y: auto; padding: 28px; }

/* ── CARDS ── */
.card {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; border: 1px solid rgba(0,0,0,.04);
}
.card-title { font-size: 14px; font-weight: 700; color: var(--gray-700); margin-bottom: 4px; }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; border: 1px solid rgba(0,0,0,.04);
  display: flex; flex-direction: column; gap: 4px;
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.indigo { background: #eef2ff; color: var(--primary); }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-icon.amber { background: #fef3c7; color: var(--warning); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-label { font-size: 11.5px; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 30px; font-weight: 800; color: var(--gray-900); line-height: 1.1; }
.stat-sub { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; padding: 10px 16px;
  font-size: 11px; font-weight: 700; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--gray-200); background: var(--gray-50);
}
td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbff; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-teal   { background: #ccfbf1; color: #0f766e; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none; transition: all .15s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 2px 6px rgba(var(--primary-rgb),.35); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(var(--primary-rgb),.4); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: .9; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-outline { background: white; border: 1px solid var(--gray-200); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--gray-300); background: var(--gray-50); }

/* ── SECTION HEADER ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-header h2 { font-size: 18px; font-weight: 700; color: var(--gray-900); }

/* ── GRID LAYOUTS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--gray-600); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm); font-size: 13.5px; color: var(--gray-800);
  background: white; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.12);
}
textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ── MODAL ── */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
#modal-box {
  background: white; border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 90%; max-width: 580px; max-height: 88vh; overflow-y: auto;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(.96) translateY(8px); } to { opacity:1; transform: none; } }
#modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--gray-200); }
#modal-title { font-size: 16px; font-weight: 700; }
#modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--gray-400); line-height: 1; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
#modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
#modal-body { padding: 24px; }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--gray-900); color: white;
  padding: 12px 20px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  z-index: 2000; box-shadow: var(--shadow-md); animation: slideup .25s ease;
  max-width: 320px;
}
#toast.hidden { display: none !important; }
@keyframes slideup { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: none; } }

/* ── CALENDAR ── */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--gray-200); border-radius: var(--radius-sm); overflow: hidden; }
.cal-day-header { background: var(--gray-100); padding: 8px; text-align: center; font-size: 11px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; }
.cal-day { background: white; padding: 6px; min-height: 80px; position: relative; }
.cal-day.other-month { background: var(--gray-50); }
.cal-day.today { background: #fafbff; }
.cal-day-num { font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 2px; }
.cal-day.today .cal-day-num { color: var(--primary); font-weight: 800; background: var(--primary); color: white; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.cal-event { font-size: 10.5px; padding: 1px 5px; border-radius: 4px; margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-event.airbnb  { background: #ffe4e6; color: #9f1239; }
.cal-event.booking { background: #dbeafe; color: #1e40af; }
.cal-event.direct  { background: #d1fae5; color: #065f46; }
.cal-event.livvi   { background: #ede9fe; color: #5b21b6; }

/* ── TIMELINE ── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content:''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--gray-200); }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-dot { position: absolute; left: -24px; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 0 1px var(--gray-200); }
.tl-dot.green { background: var(--success); }
.tl-dot.amber { background: var(--warning); }
.tl-dot.red   { background: var(--danger); }
.tl-dot.blue  { background: var(--primary); }
.tl-label { font-size: 11.5px; color: var(--gray-400); }
.tl-text { font-size: 13.5px; font-weight: 500; }

/* ── PROPERTY CARDS ── */
.property-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.prop-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border: 1px solid rgba(0,0,0,.04); transition: box-shadow .2s, transform .2s; }
.prop-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.prop-img { height: 140px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); display: flex; align-items: center; justify-content: center; position: relative; }
.prop-img svg { width: 52px; height: 52px; color: white; opacity: .6; }
.prop-platform-badge { position: absolute; top: 10px; right: 10px; background: white; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 700; color: var(--primary); box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.prop-body { padding: 16px; }
.prop-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.prop-addr { font-size: 12.5px; color: var(--gray-400); margin-bottom: 12px; }
.prop-meta { display: flex; gap: 14px; font-size: 12px; color: var(--gray-500); }
.prop-meta span { display: flex; align-items: center; gap: 4px; }
.prop-footer { padding: 12px 16px; border-top: 1px solid var(--gray-100); display: flex; justify-content: space-between; align-items: center; background: var(--gray-50); }

/* ── OTA ── */
.ota-card { display: flex; align-items: center; gap: 16px; padding: 16px; border: 1.5px solid var(--gray-200); border-radius: 12px; margin-bottom: 12px; background: white; transition: border-color .15s; }
.ota-card:hover { border-color: var(--primary); }
.ota-logo { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.ota-logo.airbnb  { background: #ffe4e6; color: #e11d48; }
.ota-logo.booking { background: #dbeafe; color: #1d4ed8; }
.ota-logo.livvi   { background: #ede9fe; color: #7c3aed; }
.ota-info { flex: 1; }
.ota-name   { font-weight: 700; font-size: 14px; }
.ota-status { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.ota-actions { display: flex; gap: 8px; }

/* ── CLEANING TASKS ── */
.task-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--gray-100); }
.task-item:last-child { border-bottom: none; }
.task-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--gray-300); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
.task-check.done { background: var(--success); border-color: var(--success); }
.task-check.done::after { content: '✓'; color: white; font-size: 11px; font-weight: 700; }
.task-info { flex: 1; }
.task-name { font-size: 13.5px; font-weight: 600; }
.task-name.done { text-decoration: line-through; color: var(--gray-400); }
.task-meta { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.task-priority { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.task-priority.high   { background: var(--danger); }
.task-priority.medium { background: var(--warning); }
.task-priority.low    { background: var(--success); }

/* ── BAR CHART ── */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding: 0 4px; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%); border-radius: 5px 5px 0 0; min-height: 4px; transition: height .4s ease; opacity: .85; }
.bar:hover { opacity: 1; }
.bar-label { font-size: 10px; color: var(--gray-400); white-space: nowrap; }
.bar-val   { font-size: 10px; color: var(--gray-600); font-weight: 600; }

/* ── TABS ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gray-200); margin-bottom: 20px; }
.tab { padding: 9px 16px; font-size: 13.5px; font-weight: 600; color: var(--gray-500); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover:not(.active) { color: var(--gray-700); }

/* ── SEARCH ── */
.search-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.search-bar input { flex: 1; }

/* ── SEF ── */
.sef-table td.required { color: var(--danger); font-weight: 700; }
.sef-table td.ok       { color: var(--success); font-weight: 700; }

/* ── FINANCIAL ── */
.fin-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.fin-box { text-align: center; padding: 20px 16px; background: var(--gray-50); border-radius: 12px; border: 1px solid var(--gray-200); }
.fin-box .amount { font-size: 24px; font-weight: 800; }
.fin-box .fin-label { font-size: 12px; color: var(--gray-500); margin-top: 4px; font-weight: 500; }
.amount.income  { color: var(--success); }
.amount.expense { color: var(--danger); }
.amount.profit  { color: var(--primary); }

/* ── ERP ── */
.erp-field-map { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.erp-arrow { color: var(--gray-400); text-align: center; }

/* ── GUEST ── */
.guest-flag { font-size: 18px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--gray-400); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 12px; display: block; opacity: .5; }
.empty-state p { font-size: 14px; }
