:root {
  color-scheme: light;
  --primary: #1b7a43;
  --primary-hover: #15663a;
  --accent: #2e8b4f;
  --soft-green: rgba(46, 139, 79, 0.15);
  --bg: #95bb72;
  --surface: #f4f9ee;
  --sidebar: #1b5e34;
  --border: rgba(18, 48, 29, 0.15);
  --gold: #f2b705;
  --text: #12301d;
  --muted: #4a6a55;
  --cfms-ink: var(--text);
  --cfms-ink-soft: var(--muted);
  --cfms-accent: var(--primary);
  --cfms-accent-dark: var(--primary-hover);
  --cfms-accent-pale: var(--soft-green);
  --cfms-paper: var(--bg);
  --cfms-surface: var(--surface);
  --cfms-line: var(--border);
  --cfms-muted: var(--muted);
  --cfms-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  --cfms-radius: 14px;
}

body {
  background:
    var(--bg);
  color: var(--cfms-ink);
}

/* Shared brand logo */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-logo img {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 14px rgba(18, 48, 29, .18));
}

.intro .brand-logo img {
  width: 72px;
  height: 72px;
}

.brand-logo-text {
  line-height: 1;
}

.mobile-login-logo {
  display: none;
}

.mobile-login-logo img {
  width: 64px;
  height: 64px;
}

main.col-md-10 {
  min-width: 0;
  animation: cfms-enter .42s ease-out both;
}

main > h3 {
  color: var(--cfms-ink);
  font-weight: 700;
  letter-spacing: -.035em;
}

.side {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--sidebar) !important;
  box-shadow: 8px 0 28px rgba(0, 0, 0, .12);
}

.side-links {
  display: grid;
  gap: .12rem;
}

.side h6 {
  padding: .8rem .65rem 1rem;
  font-size: .82rem;
  line-height: 1.5;
  letter-spacing: .055em;
  text-transform: uppercase;
  color: #fff !important;
}

.side a {
  display: block;
  margin: .16rem 0;
  padding: .68rem .8rem !important;
  border: 1px solid transparent;
  text-decoration: none;
  color: #fff !important;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.side a:hover {
  transform: translateX(3px);
  background: var(--accent) !important;
}

.side a.on {
  border-color: rgba(242, 183, 5, .45);
  background: #2e8b4f !important;
  box-shadow: inset 4px 0 var(--gold);
}

.ui-icon {
  display: inline-block;
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  vertical-align: -.18em;
}

.side-links a {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.side-links a .ui-icon {
  width: 1.12rem;
  height: 1.12rem;
  opacity: .9;
}

.side .profile-menu {
  position: relative;
  margin-top: auto;
  padding-top: 1rem;
}

.profile-menu summary {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  list-style: none;
  transition: background-color .18s ease, border-color .18s ease;
}

.profile-menu summary::-webkit-details-marker {
  display: none;
}

.profile-menu summary:hover,
.profile-menu[open] summary {
  border-color: rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .12);
}

.profile-avatar {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  color: #fff;
}

.profile-avatar .ui-icon {
  width: 1.3rem;
  height: 1.3rem;
}

.profile-copy {
  display: grid;
  min-width: 0;
  gap: .12rem;
}

.profile-copy strong,
.profile-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-copy strong {
  font-size: .88rem;
  font-weight: 600;
}

.profile-copy small {
  color: rgba(255, 255, 255, .75);
  font-size: .75rem;
  text-transform: capitalize;
}

.profile-chevron {
  margin-left: auto;
  color: rgba(255, 255, 255, .75);
  transition: transform .18s ease;
}

.profile-chevron .ui-icon {
  width: 1rem;
  height: 1rem;
}

.profile-menu[open] .profile-chevron {
  transform: rotate(180deg);
}

.profile-popover {
  position: absolute;
  z-index: 20;
  right: 0;
  bottom: calc(100% + .35rem);
  left: 0;
  padding: .35rem;
  border: 1px solid rgba(220, 230, 226, .9);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(10, 31, 38, .2);
}

.side .profile-popover a {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: .12rem 0;
  padding: .62rem .7rem !important;
  border-radius: 8px;
  color: var(--cfms-ink) !important;
}

.side .profile-popover a:hover {
  transform: none;
  background: var(--cfms-accent-pale) !important;
}

.btn .ui-icon,
.btn-login .ui-icon {
  margin-right: .35rem;
}

.btn-sm .ui-icon {
  width: .95rem;
  height: .95rem;
}

.card {
  border: 1px solid rgba(220, 230, 226, .9);
  border-radius: var(--cfms-radius);
  box-shadow: var(--cfms-shadow);
}

.card.stat {
  border-left: 4px solid var(--cfms-accent);
  transition: transform .2s ease, box-shadow .2s ease;
  animation: cfms-rise .45s ease-out both;
}

.card.stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--cfms-shadow);
}

.card.stat .fs-3 {
  color: var(--cfms-ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
}

.card > h5,
.card > h6 {
  color: var(--cfms-ink);
  font-weight: 650;
}

.btn {
  border-radius: 9px;
  font-weight: 550;
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-success {
  --bs-btn-bg: var(--cfms-accent);
  --bs-btn-border-color: var(--cfms-accent);
  --bs-btn-hover-bg: var(--cfms-accent-dark);
  --bs-btn-hover-border-color: var(--cfms-accent-dark);
  --bs-btn-active-bg: var(--cfms-accent-dark);
  --bs-btn-active-border-color: var(--cfms-accent-dark);
}

.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(47, 143, 131, .35);
  outline-offset: 2px;
}

.form-control,
.form-select {
  border-color: var(--cfms-line);
  border-radius: 9px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--cfms-accent);
  box-shadow: 0 0 0 .22rem rgba(47, 143, 131, .14);
}

.form-label {
  color: #40565d;
  font-weight: 550;
}

.table {
  --bs-table-color: var(--cfms-ink);
  --bs-table-striped-bg: rgba(46, 139, 79, .06);
  --bs-table-hover-bg: rgba(46, 139, 79, .1);
}

.table thead th {
  background: rgba(46, 139, 79, .08);
  color: var(--text);
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.cfms-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 240px;
  animation: cfms-fade .45s ease-out both;
}

.cfms-chart-host {
  min-height: 240px;
}

.chart-grid { stroke: #e5ece9; stroke-width: 1; }
.chart-axis { fill: #64777b; font: 12px system-ui, sans-serif; }
.chart-axis-line { stroke: #9aaba7; stroke-width: 1; }
.chart-legend { fill: #405359; font: 12px system-ui, sans-serif; }
.chart-value { fill: var(--cfms-ink); font: 11px system-ui, sans-serif; }
.chart-total { fill: var(--cfms-ink); font: 700 25px system-ui, sans-serif; }
.chart-empty { fill: #64777b; font: 14px system-ui, sans-serif; }

@keyframes cfms-enter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cfms-rise {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cfms-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 767.98px) {
  .cfms-brand .brand-logo-text {
    display: none;
  }

  .cfms-brand {
    justify-content: center;
  }

  .mobile-login-logo {
    display: flex;
    margin: 0 auto 1rem;
  }

  .side {
    position: relative;
    height: auto;
    min-height: auto !important;
    padding-bottom: .8rem !important;
  }

  .side h6 {
    margin-bottom: .25rem !important;
    padding-bottom: .45rem;
  }

  .side a {
    display: inline-block !important;
    margin: .12rem .08rem;
    padding: .46rem .62rem !important;
    font-size: .86rem;
  }

  .side-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .1rem .35rem;
  }

  .side-links a {
    display: flex !important;
  }

  main.col-md-10 {
    padding: 1.25rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  body { background: #fff !important; }
  .side, .no-print { display: none !important; }
  main.col-md-10 { width: 100% !important; max-width: 100% !important; padding: 0 !important; }
  .card { border: 0 !important; box-shadow: none !important; }
}

/* Bootstrap and shared light-theme overrides */
.btn-primary,
.btn-success,
.bg-primary {
  color: #fff !important;
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-success:hover,
.btn-success:focus {
  background-color: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
}

.text-primary { color: var(--accent) !important; }
.border-primary { border-color: var(--primary) !important; }
.badge { color: var(--text) !important; background-color: var(--gold) !important; }
.page-link { color: var(--primary); background-color: var(--surface); border-color: var(--border); }
.page-link:hover,
.page-item.active .page-link { color: #fff; background-color: var(--primary); border-color: var(--primary); }
.form-control,
.form-select { color: var(--text); background: #fff; border-color: var(--border); }
.form-control:focus,
.form-select:focus { color: var(--text); border-color: var(--accent); background: #fff; box-shadow: 0 0 0 .2rem var(--soft-green); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.nav-pills .nav-link { color: var(--muted); }
.nav-pills .nav-link.active { color: #fff; background-color: var(--primary); }
.modal-content,
.dropdown-menu,
.swal2-popup { color: var(--text); background: var(--surface); border-color: var(--border); }
.dropdown-item { color: var(--text); }
.dropdown-item:hover { color: var(--text); background: var(--soft-green); }
.modal-header,
.modal-footer { border-color: var(--border); }
.swal2-title,
.swal2-html-container { color: var(--text) !important; }
.swal2-confirm { background-color: var(--primary) !important; }

/* DASHBOARD CHARTS (glass) */
:root {
  --dashboard-glass: var(--surface);
  --dashboard-border: var(--border);
  --dashboard-blue: var(--primary);
  --dashboard-cyan: var(--accent);
  --dashboard-violet: var(--gold);
  --dashboard-green: var(--accent);
  --dashboard-red: var(--primary-hover);
  --dashboard-muted: var(--muted);
}

.cfms-main .stat-card,
.cfms-main .chart-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--dashboard-border) !important;
  border-radius: 20px !important;
  color: var(--text) !important;
  background: var(--dashboard-glass) !important;
  box-shadow: var(--cfms-shadow) !important;
}

.cfms-main .stat-card::before,
.cfms-main .chart-card::before {
  position: absolute;
  top: 0;
  right: 12%;
  left: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  content: "";
}

.cfms-main .stat-card {
  min-height: 148px;
  transition: transform .2s ease, box-shadow .2s ease;
}

.cfms-main .stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .12) !important;
}

.stat-card-total-students, .stat-card-total-faculty, .stat-card-total-courses, .stat-card-feedback-submitted, .stat-card-pending-evaluations, .stat-card-average-faculty-rating { background: var(--surface) !important; }

.stat-card-main {
  display: flex;
  align-items: center;
  gap: .85rem;
}

.stat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 13px;
  color: var(--accent);
  background: var(--soft-green);
}

.stat-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.stat-label {
  color: var(--dashboard-muted);
  font-size: .75rem;
  font-weight: 600;
}

.stat-card .stat-value {
  margin-top: .18rem !important;
  color: var(--text) !important;
  letter-spacing: -.04em;
}

.stat-card-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: .5rem;
  margin-top: 1rem;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  padding: .18rem .42rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
}

.trend-up {
  color: var(--dashboard-green);
  background: rgba(52,211,153,.12);
}

.trend-down {
  color: var(--dashboard-red);
  background: rgba(248,113,113,.12);
}

.stat-sparkline {
  width: 120px;
  height: 34px;
  overflow: visible;
}

.spark-area {
  opacity: .16;
}

.spark-line {
  fill: none;
  stroke: var(--dashboard-cyan);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.chart-card {
  min-height: 360px;
}

.chart-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.chart-card-header h6 {
  margin: 0;
  color: var(--text) !important;
  font-size: .96rem;
  font-weight: 650;
}

.chart-card-header p {
  margin: .3rem 0 0;
  color: var(--dashboard-muted);
  font-size: .75rem;
}

.chart-period,
.chart-legend-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .62rem;
  border: 1px solid var(--dashboard-border);
  border-radius: 999px;
  color: var(--dashboard-muted);
  background: rgba(46,139,79,.06);
  font-size: .7rem;
  white-space: nowrap;
}

.chart-legend-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dashboard-cyan);
  box-shadow: 0 0 9px var(--dashboard-cyan);
}

.cfms-chart-host {
  min-height: 275px;
  margin-top: .65rem;
}

.cfms-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 275px;
  overflow: visible;
}

.chart-grid {
  stroke: rgba(18, 48, 29, 0.12);
  stroke-dasharray: 4 7;
}

.chart-axis,
.chart-legend {
  fill: var(--dashboard-muted);
  font: 11px Inter, system-ui, sans-serif;
}

.chart-value,
.chart-percent {
  fill: var(--text);
  font: 600 11px Inter, system-ui, sans-serif;
}

.chart-line {
  fill: none;
  stroke: url(#line-c2);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.chart-area { pointer-events: none; }
.chart-dot {
  cursor: pointer;
  fill: var(--dashboard-cyan);
  stroke: var(--accent);
  stroke-width: 2;
  transition: r .15s ease, filter .15s ease;
}

.chart-dot.is-hovered,
.chart-bar.is-hovered,
.donut-segment.is-hovered {
  filter: brightness(1.15) drop-shadow(0 0 8px rgba(46,139,79,.35));
}

.chart-dot.is-hovered { r: 7; }
.chart-guide { stroke: rgba(18, 48, 29, 0.22); stroke-dasharray: 3 5; }
.chart-bar { transform-box: fill-box; transform-origin: bottom; transition: height .6s ease-out, y .6s ease-out, filter .15s ease; }
.chart-tooltip { pointer-events: none; }
.chart-tooltip rect { fill: var(--surface); stroke: var(--dashboard-border); }
.tooltip-title { fill: var(--dashboard-muted); font: 10px Inter, system-ui, sans-serif; }
.tooltip-value { fill: var(--text); font: 600 11px Inter, system-ui, sans-serif; }
.chart-total { fill: #12301d; font: 700 26px Inter, system-ui, sans-serif; }
.donut-segment { cursor: pointer; transition: transform .15s ease, filter .15s ease; transform-box: fill-box; transform-origin: center; }
.donut-segment.is-hovered { transform: scale(1.04); }
.donut-segment.is-dimmed { opacity: .4; }
.cfms-donut-svg {
  width: 100%;
  max-width: 220px;
  height: auto;
  min-height: 0;
  flex: 0 1 220px;
  animation: none !important;
  opacity: 1 !important;
}
.cfms-donut-svg .donut-segment {
  fill: none !important;
  opacity: 1;
  animation: none !important;
  transform: none !important;
  transform-box: initial;
  transform-origin: initial;
}
.donut-legend {
  display: grid;
  align-content: center;
  gap: .75rem;
  min-width: 150px;
  flex: 1;
}
.donut-legend-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: .55rem;
  color: var(--dashboard-muted);
  font-size: .75rem;
}
.donut-legend-row strong {
  color: #12301d;
  font-size: .72rem;
  font-weight: 600;
}
.donut-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
#c3 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  min-height: 0;
  overflow: visible;
}
.report-content .cfms-chart-host {
  min-height: 0;
  margin-top: .65rem;
}
.report-content .cfms-chart-svg {
  min-height: 0;
}
#categoryChart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  min-height: 0;
  overflow: visible;
}
#categoryChart .cfms-donut-svg {
  width: 100%;
  max-width: 220px;
  height: auto;
  min-height: 0;
  flex: 0 1 220px;
}
#categoryChart .donut-legend {
  min-width: 170px;
  flex: 1 1 170px;
}
.chart-empty { fill: var(--dashboard-cyan); font: 28px Inter, system-ui, sans-serif; }
.chart-empty-label { fill: var(--dashboard-muted); font: 12px Inter, system-ui, sans-serif; }

.summary-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.summary-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: fit-content;
  gap: 1.5rem;
  padding: .55rem .8rem;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 8px 20px rgba(27,122,67,.22);
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
}

.summary-link:hover { color: #fff; filter: brightness(1.12); }

@media (max-width: 575.98px) {
  .dashboard-stat-grid > div { width: 100%; }
  .chart-card-header { gap: .5rem; }
  .chart-period { display: none; }
  .cfms-chart-svg { min-height: 240px; }
  .cfms-chart-host { min-height: 240px; }
  #c3 { flex-wrap: wrap; }
  .donut-legend { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .cfms-main .stat-card,
  .chart-dot,
  .chart-bar,
  .donut-segment { transition: none !important; }
  .chart-bar { transition: none !important; }
}

/* FORCE MODAL TO BE USABLE */
.modal { z-index: 200000 !important; }
.modal-backdrop { z-index: 199990 !important; }
.modal-dialog { position: relative; z-index: 200001 !important; pointer-events: auto !important; }
.modal-content {
  background: var(--surface) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
.modal input, .modal select, .modal textarea, .modal button {
  pointer-events: auto !important;
  position: relative;
  z-index: 1;
}