:root {
  --ink: #1f2937;
  --muted: #667085;
  --line: #dce3ea;
  --surface: #ffffff;
  --soft: #f6f8fb;
  --soft-strong: #edf2f7;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e7f7f4;
  --info: #2563eb;
  --warning: #b45309;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --shadow: 0 18px 45px rgba(31, 41, 55, .08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(231, 247, 244, .55), rgba(246, 248, 251, 0) 320px),
    var(--soft);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-nav {
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid rgba(31, 41, 55, .08);
  backdrop-filter: blur(18px);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius);
  font-size: .78rem;
  letter-spacing: 0;
}

.nav-actions,
.hero-actions,
.header-actions {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.system-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .38rem .65rem;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid rgba(15, 118, 110, .16);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
}

.pulse-dot {
  width: .5rem;
  height: .5rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 .28rem rgba(15, 118, 110, .12);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

.app-shell {
  max-width: 1500px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.hero-copy,
.health-panel,
.stat-card,
.content-card {
  border: 1px solid rgba(31, 41, 55, .08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .95);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 1.35rem;
  animation: fade-up .45s ease both;
}

.section-kicker,
.micro-label {
  color: var(--accent);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-kicker.danger {
  color: var(--danger);
}

.hero-copy h1 {
  margin: .45rem 0 .45rem;
  font-size: 2.45rem;
  line-height: 1.05;
  font-weight: 850;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 760px;
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 1rem;
}

.health-panel {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 1.2rem;
  animation: fade-up .5s ease both;
}

.health-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) var(--value), var(--soft-strong) 0);
  transition: background .45s ease;
}

.health-ring::after {
  position: absolute;
  width: 94px;
  height: 94px;
  content: "";
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.health-ring span,
.health-ring small {
  position: relative;
  z-index: 1;
}

.health-ring span {
  display: block;
  font-size: 1.65rem;
  font-weight: 850;
}

.health-ring small {
  margin-top: 2rem;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.health-copy strong {
  display: block;
  margin: .2rem 0;
  font-size: 1.1rem;
}

.health-copy small {
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  min-height: 128px;
  padding: 1.05rem;
  animation: fade-up .55s ease both;
}

.stat-card span,
.stat-card small {
  color: var(--muted);
  font-weight: 700;
}

.stat-card span {
  font-size: .82rem;
}

.stat-card strong {
  display: block;
  margin: .35rem 0 .1rem;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1rem;
  align-items: start;
}

.content-card {
  padding: 1.1rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.section-header.compact {
  margin-bottom: .85rem;
}

.section-header h2 {
  margin: .2rem 0 .1rem;
  font-size: 1.25rem;
  font-weight: 850;
}

.section-header p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}

.filters-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(145px, 1fr));
  gap: .65rem;
  margin-bottom: .8rem;
}

.form-control,
.form-select {
  border-color: #d7dee8;
  border-radius: var(--radius);
  padding: .68rem .82rem;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(15, 118, 110, .55);
  box-shadow: 0 0 0 .22rem rgba(15, 118, 110, .13);
}

.form-select-sm {
  min-width: 128px;
  padding-top: .45rem;
  padding-bottom: .45rem;
}

.btn {
  border-radius: var(--radius);
  font-weight: 750;
}

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

.btn-primary:hover,
.btn-primary:focus {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.btn-dark {
  border-color: var(--ink);
  background: var(--ink);
}

.btn-danger {
  border-color: var(--danger);
  background: var(--danger);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  min-height: 2rem;
  margin-bottom: .65rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .38rem .58rem;
  color: var(--ink);
  background: var(--soft-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 750;
}

.filter-chip.muted {
  color: var(--muted);
  background: transparent;
}

.filter-chip button {
  display: grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font-weight: 900;
  line-height: 1;
}

.app-table {
  min-width: 980px;
}

.app-table th {
  color: var(--muted);
  border-bottom-color: var(--line);
  font-size: .73rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-table td {
  border-bottom-color: var(--line);
  padding: .95rem .55rem;
  vertical-align: middle;
}

.app-table tbody tr {
  transition: background .18s ease, transform .18s ease;
}

.app-table tbody tr:hover {
  background: rgba(15, 118, 110, .04);
}

.student-cell {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 850;
}

.student-name,
.path-title,
.contact-line {
  display: block;
  font-weight: 800;
}

.student-email,
.meta-line,
.contact-sub {
  display: block;
  color: var(--muted);
  font-size: .82rem;
}

.status-badge {
  display: inline-flex;
  padding: .34rem .68rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 850;
}

.status-active {
  color: #067647;
  background: #dcfae6;
}

.status-graduated {
  color: #175cd3;
  background: #dbeafe;
}

.status-inactive {
  color: #b42318;
  background: var(--danger-soft);
}

.row-actions {
  display: inline-flex;
  gap: .35rem;
  align-items: center;
}

.row-flash {
  animation: row-flash 1.3s ease both;
}

.empty-state {
  padding: 2.4rem 1rem;
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: .25rem;
  font-size: 1.05rem;
}

.directory-footer {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  margin-top: .9rem;
}

.page-link {
  color: var(--ink);
  border-color: var(--line);
}

.active > .page-link {
  border-color: var(--accent);
  background: var(--accent);
}

.side-stack {
  display: grid;
  gap: 1rem;
}

.status-mix {
  display: grid;
  gap: .85rem;
}

.mix-row {
  display: grid;
  gap: .35rem;
}

.mix-head {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.mix-track {
  height: .55rem;
  overflow: hidden;
  background: var(--soft-strong);
  border-radius: 999px;
}

.mix-fill {
  display: block;
  width: var(--width);
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width .45s ease;
}

.mix-fill.graduated {
  background: var(--info);
}

.mix-fill.inactive {
  background: var(--danger);
}

.activity-list {
  display: grid;
  gap: .7rem;
}

.activity-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .65rem;
  align-items: start;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.activity-dot {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: var(--radius);
  font-size: .75rem;
  font-weight: 850;
}

.activity-item strong {
  display: block;
  font-size: .88rem;
}

.activity-item span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
}

.modal-content {
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(31, 41, 55, .22);
}

.modal-header,
.modal-footer {
  border: 0;
  padding: 1.2rem 1.35rem;
}

.modal-body {
  padding: 0 1.35rem 1.2rem;
}

.form-section {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.form-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.form-section h3 {
  margin-bottom: .75rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.toast {
  color: var(--ink);
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 1rem 3rem rgba(31, 41, 55, .18);
}

.toast.success {
  border-left: 4px solid var(--accent) !important;
}

.toast.error {
  border-left: 4px solid var(--danger) !important;
}

.skeleton-line {
  display: block;
  width: 100%;
  height: .8rem;
  overflow: hidden;
  background: linear-gradient(90deg, #eef2f6, #f8fafc, #eef2f6);
  background-size: 220% 100%;
  border-radius: 999px;
  animation: shimmer 1.1s linear infinite;
}

.skeleton-line.short {
  width: 54%;
  margin-top: .45rem;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  from {
    background-position: 220% 0;
  }
  to {
    background-position: -220% 0;
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    box-shadow: 0 0 0 .24rem rgba(15, 118, 110, .12);
  }
  50% {
    box-shadow: 0 0 0 .42rem rgba(15, 118, 110, .04);
  }
}

@keyframes row-flash {
  0% {
    background: rgba(15, 118, 110, .18);
  }
  100% {
    background: transparent;
  }
}

@media (max-width: 1180px) {
  .dashboard-hero,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-control {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .nav-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: .8rem;
    width: 100%;
  }

  .app-nav .container-fluid {
    align-items: flex-start;
  }

  .hero-copy h1 {
    font-size: 2rem;
  }

  .hero-actions,
  .header-actions,
  .section-header,
  .health-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .health-panel {
    display: flex;
  }

  .stats-grid,
  .filters-bar {
    grid-template-columns: 1fr;
  }

  .system-pill {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
