:root {
  color-scheme: light;
  --brand: #1f7a63;
  --ink: #17211d;
  --muted: #66736d;
  --line: #dbe4df;
  --soft: #f4f7f5;
  --danger: #b42318;
  --warning: #9a6700;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: #f7f9f8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.portal-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 100vh;
}

.portal-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid #24352e;
  background: #15261f;
  color: #fff;
}

.portal-brand {
  display: flex;
  gap: 11px;
  align-items: center;
  min-height: 46px;
  margin-bottom: 24px;
}

.portal-brand img,
.portal-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--brand);
}

.portal-brand-mark {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
}

.portal-brand strong,
.portal-brand span {
  display: block;
}

.portal-brand span {
  margin-top: 3px;
  color: #a9bbb3;
  font-size: 12px;
}

.portal-nav {
  display: grid;
  gap: 6px;
}

.portal-nav button {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  color: #c9d5d0;
  background: transparent;
  text-align: left;
}

.portal-nav button:hover,
.portal-nav button.is-active {
  color: #fff;
  background: #284039;
}

.portal-workspace {
  min-width: 0;
}

.portal-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 72px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.portal-topbar h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.portal-user {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.portal-content {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 28px 52px;
}

.portal-view {
  display: none;
}

.portal-view.is-active {
  display: block;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.metric-cell {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
}

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

.metric-cell span,
.metric-cell strong {
  display: block;
}

.metric-cell span {
  color: var(--muted);
  font-size: 12px;
}

.metric-cell strong {
  margin-top: 8px;
  font-size: 26px;
}

.data-section {
  margin-bottom: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.data-list {
  display: grid;
  gap: 0;
}

.data-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(140px, 0.8fr) minmax(120px, 0.6fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 64px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.data-row:last-child {
  border-bottom: 0;
}

.data-row strong,
.data-row span,
.data-row small {
  display: block;
  min-width: 0;
}

.data-row span,
.data-row small,
.muted {
  color: var(--muted);
}

.data-row small {
  margin-top: 4px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: #e8eeeb;
}

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

.status {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  padding: 0 9px;
  align-items: center;
  border-radius: 6px;
  color: #246b56;
  background: #e9f5f0;
  font-size: 12px;
  font-weight: 700;
}

.status.warning {
  color: var(--warning);
  background: #fff4ce;
}

.status.danger {
  color: var(--danger);
  background: #feeceb;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 7px;
  font-weight: 700;
}

.primary-button {
  border: 1px solid var(--brand);
  color: #fff;
  background: var(--brand);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.text-button {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  color: var(--brand);
  background: transparent;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form input,
.inline-form select,
.inline-form textarea,
.auth-form input,
.auth-form select {
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
}

.essay-feedback {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.essay-feedback textarea {
  min-height: 72px;
  padding: 10px;
  resize: vertical;
}

.school-group {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.school-group:last-child {
  border-bottom: 0;
}

.school-line {
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) minmax(160px, 1fr) minmax(120px, 0.6fr) minmax(110px, 0.5fr);
  gap: 14px;
  padding: 11px 0;
}

.timeline {
  position: relative;
  display: grid;
  gap: 0;
  padding-left: 18px;
}

.timeline::before {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 4px;
  width: 1px;
  background: var(--line);
  content: "";
}

.timeline-item {
  position: relative;
  padding: 0 0 20px 16px;
}

.timeline-item::before {
  position: absolute;
  top: 6px;
  left: -18px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
  content: "";
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #edf2ef;
}

.auth-box {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.auth-box h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.auth-box p {
  margin: 8px 0 22px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label,
.auth-form label span {
  display: grid;
  gap: 6px;
}

.auth-form label span {
  color: var(--muted);
  font-size: 12px;
}

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

.platform-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.platform-form-grid label,
.platform-form-grid label span {
  display: grid;
  gap: 6px;
}

.platform-form-grid label span {
  color: var(--muted);
  font-size: 12px;
}

.platform-form-grid input,
.platform-form-grid select {
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.platform-table-wrap {
  overflow-x: auto;
}

.platform-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.platform-table th,
.platform-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.platform-table th {
  color: var(--muted);
  font-size: 12px;
}

.platform-table td strong,
.platform-table td span {
  display: block;
}

.platform-table td span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: min(380px, calc(100vw - 44px));
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  background: #17211d;
  box-shadow: 0 10px 30px rgba(23, 33, 29, 0.2);
}

@media (max-width: 900px) {
  .portal-shell {
    display: block;
  }

  .portal-sidebar {
    position: static;
    height: auto;
    padding: 14px 16px;
  }

  .portal-brand {
    margin-bottom: 12px;
  }

  .portal-nav {
    display: flex;
    overflow-x: auto;
  }

  .portal-nav button {
    width: auto;
    min-width: max-content;
  }

  .portal-topbar {
    padding: 0 18px;
  }

  .portal-content {
    padding: 20px 18px 42px;
  }

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

  .metric-cell:nth-child(2) {
    border-right: 0;
  }

  .metric-cell:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .data-row,
  .school-line {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .platform-form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .portal-topbar {
    align-items: flex-start;
    padding: 14px 16px;
  }

  .portal-user {
    align-items: flex-end;
    flex-direction: column;
  }

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

  .metric-cell,
  .metric-cell:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-cell:last-child {
    border-bottom: 0;
  }

  .essay-feedback {
    grid-template-columns: 1fr;
  }

  .platform-form-grid {
    grid-template-columns: 1fr;
  }
}
