:root {
  color-scheme: light;
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-alt: #eef3f0;
  --ink: #1f2925;
  --muted: #66706b;
  --line: #d8dfd9;
  --green: #2f6f53;
  --green-strong: #245640;
  --blue: #355c7d;
  --gold: #b9822d;
  --rust: #a34f35;
  --focus: #2f6f53;
  --shadow: 0 16px 44px rgba(31, 41, 37, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 32px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0;
}

p {
  color: var(--muted);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #fbfcfa;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: grid;
  gap: 4px;
  padding: 0 4px 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--green);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

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

.nav-button,
.curriculum-row {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 10px 12px;
}

.nav-button:hover,
.curriculum-row:hover {
  background: var(--surface-alt);
}

.nav-button.is-active,
.curriculum-row.is-selected {
  background: #e3eee8;
  border-color: #b9d1c4;
  color: var(--green-strong);
  font-weight: 700;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.account-pill {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
  display: grid;
  gap: 8px;
  font-size: 13px;
  word-break: break-word;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  background: var(--rust);
}

.status-dot.online {
  background: var(--green);
}

.main {
  min-width: 0;
  padding: 28px;
}

.notice {
  margin-bottom: 16px;
  border: 1px solid #d8c08f;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #fffaf0;
  color: #604313;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--green-strong);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
}

.lede {
  max-width: 760px;
  margin-bottom: 0;
  font-size: 16px;
}

.header-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 8px 12px;
  font-weight: 750;
}

.primary-button {
  background: var(--green);
  color: white;
}

.primary-button:hover {
  background: var(--green-strong);
}

.secondary-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: #aebdb4;
  background: #f7faf8;
}

.compact {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 14px;
}

.text-button {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--blue);
}

.icon-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border-color: var(--line);
  background: var(--surface);
}

.panel,
.metric,
.recommendation-card,
.detail-panel,
.student-card,
.review-item,
.queue-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel-heading,
.student-card-heading,
.detail-heading,
.title-row,
.review-heading,
.queue-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.panel-heading {
  margin-bottom: 14px;
}

.panel-heading h2,
.detail-heading h2,
.title-row h2 {
  margin-bottom: 0;
}

.panel-heading span,
.student-card-heading span,
.detail-heading span,
.queue-heading span {
  color: var(--muted);
  font-size: 13px;
}

.assessment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 18px;
}

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

.form-grid.compact-grid {
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-help,
.fieldset-help,
.checkbox-label small {
  color: #738078;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.field-help {
  max-width: 56ch;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cdd7d0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 111, 83, 0.16);
}

.wide {
  grid-column: 1 / -1;
}

.priority-fieldset {
  margin: 18px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.priority-fieldset legend {
  padding: 0 8px;
  color: var(--ink);
  font-weight: 800;
}

.fieldset-help {
  margin: 0 0 12px;
}

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

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink);
  font-weight: 650;
}

.checkbox-label span {
  display: grid;
  gap: 2px;
}

.checkbox-label strong {
  color: var(--ink);
  font-size: 13px;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 2px;
  accent-color: var(--green);
}

.inline-checkbox {
  align-content: center;
  min-height: 42px;
}

.student-list {
  display: grid;
  gap: 12px;
}

.student-card {
  padding: 14px;
  box-shadow: none;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  padding: 16px;
  box-shadow: none;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 4px 0;
  font-size: 24px;
  line-height: 1.1;
}

.recommendation-list {
  display: grid;
  gap: 16px;
}

.recommendation-card {
  padding: 18px;
}

.recommendation-main {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.score-block {
  min-height: 102px;
  border: 1px solid #bfd0c7;
  border-radius: 8px;
  background: #f3faf6;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px;
}

.score-value {
  display: block;
  color: var(--green-strong);
  font-size: 30px;
  font-weight: 850;
  line-height: 1;
}

.meter {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e1e8e3;
}

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

.meter.slim {
  height: 6px;
}

.recommendation-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.recommendation-footer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.category-bars,
.child-breakdown {
  display: grid;
  gap: 8px;
}

.child-breakdown > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.plain-list li + li {
  margin-top: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #cbd9d0;
  border-radius: 999px;
  background: #f5faf7;
  color: var(--green-strong);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tag.strong {
  background: #fff7e8;
  border-color: #e0c68f;
  color: #7b5114;
}

.confidence-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  min-height: 26px;
  border: 1px solid #cbd9d0;
  border-radius: 999px;
  background: #f7faf8;
  color: var(--green-strong);
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.confidence-badge small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.confidence-badge.founder {
  background: #f6f6f2;
  border-color: #d6d8cf;
  color: #5d655e;
}

.confidence-badge.early {
  background: #fff8e9;
  border-color: #e1c98f;
  color: #765316;
}

.confidence-badge.growing {
  background: #eef6fb;
  border-color: #b9d1df;
  color: var(--blue);
}

.confidence-badge.strong {
  background: #edf8f1;
  border-color: #a9cfb7;
  color: var(--green-strong);
}

.confidence-note {
  border-left: 3px solid #b9d1c4;
  padding-left: 10px;
  font-size: 14px;
}

.filter-bar {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.library-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 18px;
}

.curriculum-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.curriculum-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

.curriculum-row span:first-child {
  display: grid;
  gap: 2px;
}

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

.detail-panel {
  padding: 20px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.fact-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfa;
}

.fact-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.fact-grid dd {
  margin: 4px 0 0;
}

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

.review-layout,
.admin-secondary,
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.public-review-layout {
  grid-template-columns: minmax(0, 980px);
}

.review-stack,
.queue-list {
  display: grid;
  gap: 10px;
}

.review-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}

.review-tab {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.review-tab.is-active {
  border-color: #b9d1c4;
  background: var(--surface);
  color: var(--green-strong);
}

.review-item,
.queue-item {
  padding: 12px;
  box-shadow: none;
}

.review-item p,
.queue-item p {
  margin-bottom: 6px;
}

.queue-item small {
  color: var(--muted);
  font-size: 12px;
}

.queue-list h3 {
  margin: 8px 0 0;
  color: var(--blue);
}

.compact-fieldset {
  margin-top: 0;
}

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

.review-admin-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 8px;
}

.review-admin-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.review-admin-grid dd {
  margin: 3px 0 0;
  color: var(--ink);
}

.admin-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.backend-panel {
  margin-bottom: 18px;
}

.community-panel {
  margin-bottom: 18px;
}

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

.confidence-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 10px;
}

.confidence-stats strong,
.confidence-stats span {
  display: block;
}

.confidence-stats strong {
  font-size: 24px;
  line-height: 1.1;
}

.confidence-stats span,
.confidence-list span + span {
  color: var(--muted);
  font-size: 12px;
}

.confidence-list {
  display: grid;
  gap: 8px;
}

.confidence-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.admin-list {
  align-self: start;
}

.weight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.weight-grid h3 {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  color: var(--blue);
}

.export-panel {
  margin-bottom: 18px;
}

.export-panel textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.empty-state {
  min-height: 420px;
  border: 1px dashed #aebdb4;
  border-radius: 8px;
  background: var(--surface);
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 30px;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .sidebar-footer {
    margin-top: 0;
  }

  .assessment-grid,
  .library-layout,
  .admin-layout,
  .review-layout,
  .admin-secondary,
  .about-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  h1 {
    font-size: 25px;
  }

  .view-header,
  .recommendation-footer {
    flex-direction: column;
  }

  .nav,
  .form-grid,
  .checkbox-grid,
  .metrics-row,
  .filter-bar,
  .recommendation-details,
  .fact-grid,
  .two-column,
  .weight-grid,
  .review-tabs,
  .confidence-stats,
  .review-admin-grid {
    grid-template-columns: 1fr;
  }

  .confidence-list div {
    flex-direction: column;
    gap: 2px;
  }

  .recommendation-main {
    grid-template-columns: 1fr;
  }

  .score-block {
    min-height: 82px;
  }

  .header-actions,
  .form-actions {
    width: 100%;
  }

  .header-actions button,
  .form-actions button {
    flex: 1;
  }
}
