@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --bg: #0a0c0f;
  --surface: #111418;
  --surface2: #181d24;
  --border: #1f2730;
  --accent: #f97316;
  --accent2: #3b82f6;
  --accent3: #10b981;
  --accent4: #a855f7;
  --text: #e8edf2;
  --muted: #5a6578;
  --muted2: #8a97a8;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* SIDEBAR */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.logo {
  padding: 28px 24px 24px;
  border-bottom: 1px solid var(--border);
}

.logo a { text-decoration: none; }

.logo-mark {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
  color: var(--text);
}

.logo-mark span { color: var(--accent); }
.logo-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 3px;
}

.tenant-badge {
  margin: 16px 16px 0;
  background: linear-gradient(135deg, #1a2332, #1a2d1f);
  border: 1px solid #2a3f2e;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.tenant-badge:hover { border-color: var(--accent3); }

.tenant-icon {
  width: 32px; height: 32px;
  background: var(--accent3);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  color: #000;
  font-family: 'Syne', sans-serif;
}

.tenant-name { font-size: 13px; font-weight: 500; }
.tenant-plan { font-size: 10px; color: var(--accent3); letter-spacing: 0.5px; }

.nav { padding: 20px 12px; flex: 1; overflow-y: auto; }

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 8px;
  margin-top: 20px;
}

.nav-label:first-child { margin-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--muted2);
  transition: all 0.15s;
  margin-bottom: 2px;
  position: relative;
  text-decoration: none;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }

.nav-item.active {
  background: rgba(249,115,22,0.12);
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  margin-left: -10px;
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.user-row:hover { background: var(--surface2); }

.avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), #fb923c);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  font-family: 'Syne', sans-serif;
}

.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--muted); }

/* MAIN */
.main {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOPBAR */
.topbar {
  height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 16px;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.topbar-date { font-size: 12px; color: var(--muted); margin-left: 4px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.search-bar {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  width: 220px;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar:focus { border-color: var(--accent); }
.search-bar::placeholder { color: var(--muted); }

.icon-btn {
  width: 36px; height: 36px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  text-decoration: none;
  color: var(--text);
}

.icon-btn:hover { border-color: var(--accent); background: rgba(249,115,22,0.08); }

.notif-dot {
  position: absolute; top: 6px; right: 7px;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  border: 1.5px solid var(--surface);
}

/* CONTENT */
.content {
  padding: 32px;
  flex: 1;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.card-action {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: none;
  font-family: 'DM Sans', sans-serif;
}

.card-action:hover { text-decoration: underline; }

/* STATUS BADGE */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.status.active { background: rgba(16,185,129,0.12); color: var(--accent3); }
.status.active::before { background: var(--accent3); }
.status.pending { background: rgba(249,115,22,0.12); color: var(--accent); }
.status.pending::before { background: var(--accent); }
.status.review { background: rgba(59,130,246,0.12); color: var(--accent2); }
.status.review::before { background: var(--accent2); }
.status.complete { background: rgba(90,101,120,0.15); color: var(--muted2); }
.status.complete::before { background: var(--muted); }
.status.overdue { background: rgba(239,68,68,0.12); color: #ef4444; }
.status.overdue::before { background: #ef4444; }

/* PROGRESS */
.prog-bar {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent2), var(--accent3));
  transition: width 0.8s ease;
}

.prog-label { font-size: 11px; color: var(--muted2); margin-bottom: 4px; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: #ea6c0a; }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--muted2);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--text); border-color: var(--muted2); }

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 540px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
}

.modal-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  width: 30px; height: 30px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--muted2);
  transition: all 0.15s;
}

.modal-close:hover { color: var(--text); border-color: var(--muted); }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* FORMS */
.form-group { margin-bottom: 18px; }
.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 7px;
  display: block;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 13.5px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--muted); }
.form-select option { background: var(--surface2); }
.form-textarea { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* KPI CARDS */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
}

.kpi-card:hover { transform: translateY(-2px); }
.kpi-card:hover.c1 { border-color: var(--accent); }
.kpi-card:hover.c2 { border-color: var(--accent2); }
.kpi-card:hover.c3 { border-color: var(--accent3); }
.kpi-card:hover.c4 { border-color: var(--accent4); }

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.06;
  transform: translate(20px, -20px);
}

.c1::after { background: var(--accent); }
.c2::after { background: var(--accent2); }
.c3::after { background: var(--accent3); }
.c4::after { background: var(--accent4); }

.kpi-label { font-size: 11px; color: var(--muted2); text-transform: uppercase; letter-spacing: 1px; font-weight: 500; }

.kpi-value {
  font-family: 'Syne', sans-serif;
  font-size: 32px;
  font-weight: 800;
  margin: 8px 0 4px;
  letter-spacing: -1px;
}

.c1 .kpi-value { color: var(--accent); }
.c2 .kpi-value { color: var(--accent2); }
.c3 .kpi-value { color: var(--accent3); }
.c4 .kpi-value { color: var(--accent4); }

.kpi-delta { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: var(--accent3); }
.kpi-delta.down { color: #ef4444; }

/* TABLE */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
  padding: 12px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 20px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.15s; cursor: pointer; }
.data-table tbody tr:hover { background: var(--surface2); }

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent3);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 13px;
  max-width: 320px;
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.error { border-left-color: #ef4444; }
.toast.info { border-left-color: var(--accent2); }

@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); } }

/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* TABS */
.page-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  padding-bottom: 0;
}

.page-tab {
  font-size: 13px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 500;
  color: var(--muted2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  text-decoration: none;
}

.page-tab:hover { color: var(--text); }
.page-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted2);
}

.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-desc { font-size: 13px; }
