:root {
  --bg: #08090c;
  --bg-elev: #0f1117;
  --bg-card: #13161f;
  --bg-card-hover: #181c28;
  --border: rgba(255, 255, 255, 0.08);
  --border-red: rgba(239, 68, 68, 0.35);
  --text: #f4f4f5;
  --text-muted: #9ca3af;
  --red: #ef4444;
  --red-dark: #b91c1c;
  --red-glow: rgba(239, 68, 68, 0.18);
  --green: #22c55e;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; color: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #27272a; border-radius: 99px; }

/* Layout Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 256px;
  background: #0b0c10;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #ef4444, #991b1b);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: -0.5px;
  color: #fff;
  box-shadow: 0 0 18px var(--red-glow);
}

.brand-text strong { display: block; font-size: 16px; letter-spacing: -0.3px; }
.brand-text span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 1.3px; color: var(--text-muted); }

.btn-cta-sidebar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-weight: 700;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.25);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn-cta-sidebar:hover { transform: translateY(-1px); filter: brightness(1.08); }

.nav-group { margin-bottom: 14px; }
.nav-group-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #6b7280;
  padding: 0 10px 6px;
  font-weight: 700;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 9px;
  color: #d4d4d8;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-link.active {
  background: linear-gradient(90deg, rgba(239,68,68,0.18), rgba(239,68,68,0.04));
  color: #fff;
  border: 1px solid var(--border-red);
}

.nav-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
  font-weight: 700;
}

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

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  font-size: 11px;
  color: #86efac;
}
.dot-green { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); flex-shrink: 0; }
.dot-red { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0; }

/* Main Content */
.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 12, 16, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title small {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--red);
  font-weight: 700;
}
.topbar-title h1 { font-size: 18px; font-weight: 700; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.pill-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}

.page-content {
  padding: 26px 28px 60px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Cards & Grids */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr); }

@media (max-width: 1024px) {
  .grid-4, .grid-3, .grid-2, .grid-sidebar { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.card-hover { transition: border-color 0.15s, transform 0.15s; }
.card-hover:hover { border-color: var(--border-red); transform: translateY(-1px); }

.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 700; }
.kpi-value { font-size: 28px; font-weight: 800; margin: 6px 0 4px; letter-spacing: -0.5px; }
.kpi-sub { font-size: 12px; color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #1a1d27;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn:hover { background: #232736; border-color: rgba(255,255,255,0.2); }
.btn-primary {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: transparent;
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-danger { background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.btn-success { background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.4); color: #86efac; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: #d4d4d8; margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%;
  background: #0b0d12;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--red); }
.textarea { min-height: 110px; resize: vertical; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); font-weight: 700; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green { background: rgba(34,197,94,0.14); color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.badge-red { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.badge-amber { background: rgba(245,158,11,0.15); color: #fcd34d; border: 1px solid rgba(245,158,11,0.3); }
.badge-blue { background: rgba(59,130,246,0.15); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.badge-gray { background: rgba(255,255,255,0.07); color: #d4d4d8; border: 1px solid var(--border); }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tab-btn {
  padding: 8px 14px;
  border-radius: 9px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tab-btn.active {
  background: var(--red-glow);
  border-color: var(--red);
  color: #fff;
}

/* Privacy Blur */
body.privacy-blur .sensitive-data {
  filter: blur(6px);
  user-select: none;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid var(--border);
}
.alert-success { background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.35); color: #bbf7d0; }
.alert-error { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.35); color: #fecaca; }
.alert-info { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.35); color: #bfdbfe; }

/* Landing Page */
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px; max-width: 1220px; margin: 0 auto;
}
.landing-hero {
  max-width: 1120px; margin: 36px auto 60px; padding: 0 24px;
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 36px; align-items: center;
}
@media (max-width: 900px) { .landing-hero { grid-template-columns: 1fr; } }

/* Floating Copilot */
.copilot-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  background: linear-gradient(135deg, #ef4444, #991b1b);
  color: #fff;
  border: none;
  border-radius: 99px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
}

.copilot-drawer {
  position: fixed;
  right: 24px;
  bottom: 78px;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: #10121a;
  border: 1px solid var(--border-red);
  border-radius: 16px;
  padding: 16px;
  z-index: 60;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  display: none;
}
.copilot-drawer.open { display: block; }

/* Bar Chart */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 16px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-fill { width: 100%; max-width: 44px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #ef4444, #7f1d1d); transition: height 0.3s ease; }
.bar-label { font-size: 11px; color: var(--text-muted); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Calendar Grid */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-cell { background: #0d0f15; border: 1px solid var(--border); border-radius: 10px; min-height: 98px; padding: 8px; }
.cal-cell-head { font-size: 11px; color: var(--text-muted); font-weight: 700; margin-bottom: 6px; }
.cal-chip { font-size: 10px; padding: 3px 6px; border-radius: 6px; background: rgba(239,68,68,0.16); border: 1px solid rgba(239,68,68,0.3); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
