:root {
  --green-950: #003f17;
  --green-900: #004d1d;
  --green-800: #075d2b;
  --green-700: #116b39;
  --green-100: #eaf4ee;
  --gold-700: #b28a00;
  --gold-600: #c59b0b;
  --gold-100: #fff3cf;
  --ink: #131815;
  --muted: #66736b;
  --line: #dde4df;
  --soft: #f7f8f5;
  --white: #ffffff;
  --danger: #c74233;
  --warning: #d79a10;
  --shadow: 0 18px 42px rgba(0, 40, 16, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #fbfcfa;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: linear-gradient(135deg, #f7f8f5 0%, #edf4ef 100%);
}

.login-card {
  width: min(480px, 100%);
  display: grid;
  gap: 18px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-brand {
  height: 110px;
  display: flex;
  align-items: center;
}

.login-brand img {
  width: 170px;
  max-height: 100px;
  object-fit: contain;
  object-position: left center;
}

.login-card h1 {
  margin: 0;
  color: var(--green-950);
  font-size: 26px;
}

.login-error {
  padding: 10px 12px;
  border: 1px solid #efccc7;
  border-radius: 6px;
  background: #fff4f2;
  color: var(--danger);
  font-weight: 800;
}

.demo-logins {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.demo-login {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.demo-login span {
  font-weight: 900;
}

.demo-login small {
  color: var(--muted);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr) 390px;
  background: var(--white);
}

.sidebar {
  background: linear-gradient(180deg, #004618 0%, #003714 100%);
  color: var(--white);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
  height: 138px;
  padding: 22px 18px;
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand img {
  width: 132px;
  max-height: 96px;
  object-fit: contain;
}

.nav-section {
  padding: 18px 12px 0;
}

.nav-title {
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 10px 12px 8px;
}

.nav-button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 0;
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.88);
  background: transparent;
  text-align: left;
  font-weight: 700;
}

.nav-button:hover,
.nav-button.active {
  background: linear-gradient(90deg, var(--gold-700), #d2ad2a);
  color: #fff;
}

.nav-dot {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 900;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px 14px 22px;
}

.identity-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: var(--green-900);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-weight: 900;
}

.avatar.gold {
  background: var(--gold-700);
}

.identity-card small,
.muted {
  color: var(--muted);
}

.identity-card small {
  color: rgba(255, 255, 255, 0.7);
}

.main {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  color: var(--green-950);
  letter-spacing: 0;
}

.top-actions,
.inline-actions,
.filters,
.tabs,
.pill-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filters {
  flex-wrap: wrap;
}

.filters .input {
  max-width: 190px;
}

.filters .select {
  max-width: 170px;
}

.select,
.input,
.textarea {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 11px;
  outline: none;
}

.input {
  min-width: 170px;
}

.textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
}

.select:focus,
.input:focus,
.textarea:focus {
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgba(17, 107, 57, 0.12);
}

.btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 11px;
  font-weight: 800;
}

.btn:hover {
  border-color: var(--green-700);
}

.btn.primary {
  background: var(--green-900);
  color: #fff;
  border-color: var(--green-900);
}

.btn.gold {
  background: var(--gold-700);
  border-color: var(--gold-700);
  color: #fff;
}

.btn.ghost {
  color: var(--green-900);
  border-color: var(--green-900);
}

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

.content {
  padding: 20px 16px;
  background: #fbfcfa;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.metric {
  display: flex;
  gap: 14px;
  align-items: center;
  min-height: 100px;
  padding: 18px 16px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green-900);
  color: #fff;
  font-weight: 900;
}

.metric-icon.gold {
  background: var(--gold-700);
}

.metric strong {
  display: block;
  font-size: 24px;
  margin-bottom: 2px;
}

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

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 16px;
  overflow: hidden;
}

.panel-header {
  padding: 16px 18px 0;
  border-bottom: 1px solid var(--line);
}

.tabs {
  gap: 28px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 0 12px;
  font-weight: 800;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--green-950);
  border-bottom-color: var(--green-900);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #3f4a43;
  background: #fafbf9;
  font-size: 12px;
  font-weight: 900;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover,
tbody tr.selected {
  background: #f2f7f3;
}

.student-cell {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 170px;
}

.student-cell strong {
  display: block;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--green-100);
  color: var(--green-800);
  font-size: 12px;
  font-weight: 800;
  margin: 2px 3px 2px 0;
}

.tag.blue {
  background: #e9f0fa;
  color: #1f5e9e;
}

.tag.gold {
  background: var(--gold-100);
  color: #8a6800;
}

.tag.red {
  background: #f9e7e4;
  color: var(--danger);
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status.submitted {
  color: var(--green-800);
  background: #ddf0e2;
}

.status.draft {
  color: #8a6800;
  background: var(--gold-100);
}

.status.not-started {
  color: var(--danger);
  background: #f9e7e4;
}

.progress {
  width: 104px;
  height: 7px;
  background: #e8ece9;
  border-radius: 99px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--green-700);
}

.progress.warn span {
  background: var(--gold-700);
}

.progress.bad span {
  background: var(--danger);
}

.lower-grid {
  display: grid;
  grid-template-columns: 1fr 1.03fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.mini-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 17px;
  min-height: 250px;
}

.mini-panel h3,
.drawer h3,
.right-rail h3 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 15px;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
}

.donut {
  width: 146px;
  height: 146px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--green-800) 0 76%, var(--gold-700) 76% 93%, var(--danger) 93% 100%);
}

.donut div {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 900;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 44px;
  gap: 10px;
  align-items: center;
  margin: 13px 0;
}

.bar {
  height: 9px;
  border-radius: 99px;
  background: #edf0ed;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green-900), #4c9a61);
}

.quick-list {
  display: grid;
  gap: 13px;
}

.quick-action {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: start;
}

.quick-action .metric-icon {
  width: 34px;
  height: 34px;
  font-size: 12px;
}

.right-rail {
  min-width: 0;
  padding: 20px 18px 24px;
  background: #fff;
}

.student-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.student-profile h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.profile-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.fact {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}

.fact strong {
  color: var(--ink);
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.rail-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.rail-tabs .tab {
  font-size: 12px;
}

.summary-table {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 18px;
}

.report-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.report-page {
  width: 100%;
  background: #fff;
  padding: 24px;
  color: #1c211e;
}

.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid #cfd8d2;
}

.report-head img {
  width: 104px;
  height: 62px;
  object-fit: contain;
  object-position: left center;
}

.report-title {
  text-align: right;
}

.report-title strong {
  display: block;
  color: var(--green-950);
  font-size: 15px;
  letter-spacing: 0.03em;
}

.report-title span {
  display: block;
  color: var(--gold-700);
  font-size: 23px;
  font-weight: 900;
}

.report-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0;
  font-size: 11px;
}

.report-banner {
  background: var(--green-900);
  color: #fff;
  text-align: center;
  padding: 7px;
  font-weight: 900;
  border-radius: 4px;
  font-size: 12px;
}

.report-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.report-stat {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

.report-stat strong {
  display: block;
  font-size: 17px;
  color: var(--ink);
}

.report-section-title {
  margin-top: 18px;
  padding: 7px 9px;
  background: var(--green-900);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.report-page table {
  table-layout: fixed;
  font-size: 11px;
}

.report-page th,
.report-page td {
  padding: 8px 7px;
  overflow-wrap: anywhere;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 20, 13, 0.28);
  z-index: 20;
  display: none;
}

.drawer-backdrop.open {
  display: block;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(760px, 100vw);
  height: 100vh;
  background: #fff;
  box-shadow: -22px 0 54px rgba(0, 40, 16, 0.18);
  z-index: 30;
  transform: translateX(102%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  min-height: 74px;
  padding: 17px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.drawer-body {
  padding: 20px 22px 110px;
  overflow: auto;
}

.drawer-foot {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: #3f4a43;
  font-size: 12px;
  font-weight: 900;
}

.field .select,
.field .input {
  width: 100%;
}

.criteria-row {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 250px 92px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.score-set {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.score-set button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  font-weight: 900;
}

.score-set button:last-child {
  border-right: 0;
}

.score-set button.active {
  background: var(--green-900);
  color: #fff;
}

.template-editor {
  display: grid;
  gap: 10px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.check-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.check-row small {
  grid-column: 2;
  color: var(--muted);
}

.template-item {
  display: grid;
  grid-template-columns: 1fr 1.45fr auto;
  gap: 10px;
  align-items: center;
}

.hidden {
  display: none !important;
}

.empty-state {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 190px minmax(620px, 1fr);
  }

  .right-rail {
    display: none;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .brand {
    height: auto;
  }

  .metric-strip,
  .lower-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .filters {
    flex-wrap: wrap;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  #printReport,
  #printReport * {
    visibility: visible;
  }

  #printReport {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
  }
}
