:root {
  --primary: #5B21B6;
  --primary-dark: #4C1D95;
  --primary-light: #7C3AED;
  --primary-soft: #F3E8FF;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #0F172A;
  --muted: #64748B;
  --success: #059669;
  --warning: #D97706;
  --danger: #DC2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --radius: 16px;
  --sidebar-width: 260px;
  --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.btn-primary, .btn-brand {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none;
  color: #fff !important;
  border-radius: 12px;
  padding: .65rem 1.2rem;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(91, 33, 182, 0.25);
}
.btn-primary:hover, .btn-brand:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff !important;
}
.btn-outline-brand {
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: 12px;
  font-weight: 600;
}
.btn-outline-brand:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.card-soft {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  height: 100%;
}
.stat-card .label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.stat-card .value { font-size: 1.55rem; font-weight: 800; margin-top: .35rem; color: var(--text); }
.stat-card .icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
  font-size: 1.15rem;
}

.table-soft {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.table-soft table { margin: 0; }
.table-soft thead th {
  background: #F1F5F9;
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 700;
}
.badge { font-weight: 600; }

/* Public site */
.public-nav {
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.public-nav .brand {
  font-weight: 800;
  color: var(--primary);
  font-size: 1.2rem;
  display: flex; align-items: center; gap: .6rem;
}
.public-nav .brand img { height: 36px; width: auto; }
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(124,58,237,.25), transparent 40%),
    radial-gradient(circle at bottom left, rgba(91,33,182,.18), transparent 35%),
    linear-gradient(180deg, #FFFFFF 0%, #F5F3FF 100%);
  padding: 5rem 0 4rem;
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}
.hero p.lead { color: var(--muted); max-width: 540px; }
.hero-panel {
  background: linear-gradient(145deg, var(--primary), var(--primary-light));
  border-radius: 24px;
  color: #fff;
  padding: 2rem;
  box-shadow: 0 25px 50px rgba(91,33,182,.35);
  min-height: 320px;
}
.section { padding: 4rem 0; }
.section-title { font-weight: 800; letter-spacing: -0.02em; margin-bottom: .5rem; }
.section-sub { color: var(--muted); margin-bottom: 2rem; }
.feature-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem;
  height: 100%;
  transition: transform .2s ease, box-shadow .2s ease;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.feature-card .icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--primary-soft); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 1rem;
}
.site-footer {
  background: #0F172A;
  color: #CBD5E1;
  padding: 3rem 0 1.5rem;
}
.site-footer a { color: #E9D5FF; }
.site-footer h5 { color: #fff; font-weight: 700; }

/* App shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #4C1D95 0%, #5B21B6 45%, #6D28D9 100%);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  padding: 1.25rem;
  overflow-y: auto;
  z-index: 100;
}
.sidebar .brand {
  font-weight: 800;
  font-size: 1.05rem;
  display: flex; align-items: center; gap: .6rem;
  margin-bottom: 1.5rem;
  color: #fff;
}
.sidebar .brand img { height: 32px; background: #fff; border-radius: 8px; padding: 2px; }
.sidebar .nav-link {
  color: rgba(255,255,255,.85);
  border-radius: 12px;
  padding: .65rem .9rem;
  margin-bottom: .25rem;
  display: flex; align-items: center; gap: .65rem;
  font-weight: 500;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
  background: rgba(255,255,255,.15);
  color: #fff;
}
.main-wrap {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}
.topbar {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 40;
}
.content { padding: 1.5rem; }
.page-title { font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.page-sub { color: var(--muted); margin: .15rem 0 0; }

.alert { border-radius: 12px; border: none; }
.form-control, .form-select {
  border-radius: 12px;
  border-color: var(--border);
  padding: .65rem .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 .2rem rgba(91,33,182,.15);
}
.form-label { font-weight: 600; font-size: .9rem; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.45);
    z-index: 90;
  }
  .sidebar-backdrop.show { display: block; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeUp .45s ease both; }
.delay-1 { animation-delay: .08s; }
.delay-2 { animation-delay: .16s; }
.delay-3 { animation-delay: .24s; }
