:root {
  --brand: #003da5;
  --brand-2: #f7941e;
  --bg: #eef3fb;
  --text: #0f1b3d;
  --surface: #ffffff;
  --muted: #6c7a9b;
}
body {
  background:
    radial-gradient(circle at 0% 0%, rgba(247, 148, 30, .09), transparent 30%),
    radial-gradient(circle at 100% 0%, rgba(0, 61, 165, .12), transparent 35%),
    linear-gradient(180deg, #f9fbff 0%, var(--bg) 100%);
  color: var(--text);
  font-weight: 450;
}
.app-navbar {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  border-top: 3px solid var(--brand-2);
  border-bottom: 1px solid rgba(0, 61, 165, .08);
}
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 260px;
  background: linear-gradient(180deg, #08214f 0%, #06173a 100%);
  color: #d6e1fb;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem .8rem .9rem;
  color: #1d3975;
  text-decoration: none;
  margin: .75rem .75rem .35rem;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(9, 33, 80, .08), 0 4px 16px rgba(8, 20, 48, .25);
}
.sidebar-group-title {
  font-size: .75rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #8ea6da;
  padding: .9rem 1rem .5rem;
  font-weight: 700;
}
.sidebar-nav { padding: 0 .6rem .6rem; display: grid; gap: .25rem; }
.sidebar-link {
  color: #c7d6fb;
  text-decoration: none;
  padding: .68rem .8rem;
  border-radius: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.sidebar-link i { font-size: 1rem; width: 1.15rem; text-align: center; }
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-link.active {
  background: linear-gradient(90deg, #f7b63f 0 4px, rgba(35,89,189,.95) 4px);
  color: #fff;
}
.sidebar-parent {
  width: 100%;
  border: 0;
  text-align: left;
  justify-content: space-between;
  background: transparent;
}
.submenu-arrow { transition: transform .2s ease; }
.sidebar-parent.active .submenu-arrow { transform: rotate(180deg); }
.sidebar-submenu {
  display: none;
  margin: -.1rem 0 .35rem 1.7rem;
  padding-left: .35rem;
  border-left: 1px dashed rgba(199,214,251,.35);
}
.sidebar-submenu.open { display: block; }
.sidebar-sublink {
  display: block;
  color: #a8c0f4;
  text-decoration: none;
  font-size: .88rem;
  border-radius: 8px;
  padding: .4rem .55rem;
  margin: .15rem 0;
}
.sidebar-sublink:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar-sublink.active {
  color: #fff;
  background: rgba(43, 108, 222, .72);
}
.app-main { flex: 1; min-width: 0; }
.app-topbar {
  height: 66px;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  border-bottom: 1px solid rgba(0,0,0,.06);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
}
.app-main-content { padding: .2rem 0 1.5rem; }
.sidebar-toggle-btn { display: inline-flex; align-items: center; justify-content: center; margin-right: .5rem; }
.navbar-brand { letter-spacing: .3px; }
.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .16));
}
.brand-logo-wide {
  width: 100%;
  max-width: 220px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .22));
}
.brand-text-wrap {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-text-top {
  font-size: .82rem;
  color: #0f2d6f;
}
.brand-text-sub {
  font-size: .74rem;
  color: #3c4f7f;
  font-weight: 600;
}
.nav-link { color: #2a3b68; font-weight: 500; border-radius: 10px; padding: .45rem .8rem !important; }
.nav-link:hover, .nav-link.active { background: rgba(0, 61, 165, .09); color: #002f7d !important; }
.page-hero {
  background: linear-gradient(120deg, rgba(0, 61, 165, .07), rgba(247, 148, 30, .10));
  border: 1px solid rgba(0, 61, 165, .08);
  padding: 1rem 1.25rem;
  border-radius: 16px;
}
.hero-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
}
.hero-logo-wide {
  width: clamp(180px, 26vw, 280px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.15));
}
.hero-unit {
  color: #193578;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .2px;
}
.hero-subtitle {
  color: #2f406e;
  font-weight: 500;
}
.text-muted {
  color: #4d5f8f !important;
}
.card {
  border-radius: 16px;
  border: 1px solid rgba(14, 29, 66, .06) !important;
  background: var(--surface);
}
.card .card-header {
  border-top-left-radius: 16px !important;
  border-top-right-radius: 16px !important;
}
.shadow-sm { box-shadow: 0 10px 32px rgba(15, 34, 84, .08) !important; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: #002f7d; border-color: #002f7d; }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.brand-title, .navbar-brand { color: var(--brand) !important; font-weight: 700; letter-spacing: .2px; }
.table thead th { white-space: nowrap; }
.table thead th { color: #24345f; font-weight: 600; }
.table tbody td { vertical-align: middle; }
.badge { font-weight: 500; }
.paper { border-radius: 10px; }
.alert-success { border-left: 4px solid #198754; }
.alert-danger { border-left: 4px solid #dc3545; }
.form-control, .form-select { border-radius: 10px; border-color: #d7dfef; }
.form-control:focus, .form-select:focus {
  border-color: #7ea1df;
  box-shadow: 0 0 0 .2rem rgba(0, 61, 165, .12);
}
.kpi-label {
  color: #425382;
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: .35rem;
}
.kpi-value {
  color: #112557;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
}
.analytics-title { font-size: 1.05rem; font-weight: 800; color: #0f2d6f; }

@media (min-width: 992px) {
  .sidebar-collapsed .app-sidebar { width: 86px; }
  .sidebar-collapsed .sidebar-brand .brand-text-top,
  .sidebar-collapsed .sidebar-brand .brand-text-sub,
  .sidebar-collapsed .sidebar-group-title,
  .sidebar-collapsed .sidebar-link span,
  .sidebar-collapsed .brand-logo-wide,
  .sidebar-collapsed .submenu-arrow,
  .sidebar-collapsed .sidebar-submenu { display: none; }
  .sidebar-collapsed .sidebar-brand::before {
    content: "PSU";
    color: #fff;
    font-size: .88rem;
    font-weight: 800;
    letter-spacing: .6px;
  }
  .sidebar-collapsed .sidebar-brand { justify-content: center; }
  .sidebar-collapsed .sidebar-link { justify-content: center; }
}

@media (max-width: 991.98px) {
  .app-shell { display: block; }
  .app-sidebar {
    width: 100%;
    min-height: auto;
    position: static;
  }
  .sidebar-nav {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  .sidebar-toggle-btn { display: none; }
  .navbar-brand {
    max-width: calc(100vw - 110px);
  }
  .brand-logo {
    width: 38px;
    height: 38px;
  }
  .brand-logo-wide {
    max-width: 180px;
  }
  .brand-text-top {
    font-size: .72rem;
  }
  .brand-text-sub {
    font-size: .67rem;
  }
  .hero-stack-mobile {
    align-items: center !important;
  }
  .hero-logo {
    width: 48px;
    height: 48px;
  }
  .hero-logo-wide {
    width: min(72vw, 260px);
  }
  .page-hero h1 {
    font-size: 1.35rem;
  }
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* Pink-White Theme Override */
:root {
  --brand: #e5009a;
  --brand-2: #ff6fcf;
  --bg: #fff2fa;
  --text: #5c1747;
  --muted: #9b5b85;
}
body {
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 111, 207, .18), transparent 30%),
    radial-gradient(circle at 100% 0%, rgba(229, 0, 154, .14), transparent 35%),
    linear-gradient(180deg, #fff9fd 0%, var(--bg) 100%);
  color: var(--text);
}
.app-sidebar {
  background: linear-gradient(180deg, #ff4dbf 0%, #d90092 100%);
  color: #fff2fa;
}
.sidebar-brand {
  color: #9f006c;
  box-shadow: inset 0 0 0 1px rgba(229, 0, 154, .12), 0 4px 16px rgba(114, 0, 71, .24);
}
.sidebar-group-title { color: #ffe5f7; }
.sidebar-link { color: #ffeef9; }
.sidebar-link.active { background: linear-gradient(90deg, #ffffff 0 4px, rgba(173, 0, 116, .95) 4px); }
.sidebar-submenu { border-left-color: rgba(255,239,249,.5); }
.sidebar-sublink { color: #ffe3f7; }
.sidebar-sublink.active { background: rgba(145, 0, 95, .72); }
.nav-link { color: #7a1f5f; }
.nav-link:hover, .nav-link.active { background: rgba(229, 0, 154, .1); color: #960066 !important; }
.page-hero {
  background: linear-gradient(120deg, rgba(255, 175, 228, .35), rgba(255, 255, 255, 1));
  border-color: rgba(229, 0, 154, .12);
}
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: #bf007f; border-color: #bf007f; }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.brand-title, .navbar-brand { color: #a1006c !important; }
.text-muted { color: #8f4e79 !important; }
.form-control:focus, .form-select:focus {
  border-color: #f07fc9;
  box-shadow: 0 0 0 .2rem rgba(229, 0, 154, .12);
}
.kpi-label { color: #8a2d69; }
.kpi-value { color: #8f005f; }
.analytics-title { color: #a1006c; }
