:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --text: #17211f;
  --muted: #62716d;
  --line: #dbe3e1;
  --accent: #11624f;
  --accent-strong: #0a493a;
  --accent-soft: #dff1ec;
  --ink-soft: #263431;
  --warning: #9d5d00;
  --warning-soft: #fff2d8;
  --danger: #a83232;
  --danger-soft: #fde7e7;
  --ok: #2f7b48;
  --ok-soft: #e4f3e9;
  --shadow: 0 12px 32px rgba(23, 33, 31, 0.07);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(17, 98, 79, 0.16), transparent 34rem),
    linear-gradient(135deg, #102520 0%, #0d1e1a 44%, #f6f8f7 44%);
}

.auth-card {
  display: grid;
  width: min(100%, 520px);
  gap: 22px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 80px rgba(8, 20, 17, 0.26);
}

.auth-brand {
  color: var(--text);
}

.auth-brand .brand-mark {
  border-color: var(--line);
  background: #102520;
  color: white;
}

.auth-brand span {
  color: var(--muted);
}

.auth-copy {
  margin-bottom: 0;
  color: var(--muted);
}

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

.auth-message {
  margin: 0;
  border-radius: 8px;
  padding: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  background: linear-gradient(180deg, #102520 0%, #0c1b18 100%);
  color: white;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: #16362f;
  font-weight: 800;
}

.brand strong,
.brand span,
.tenant-card strong,
.tenant-card span,
.tenant-card small {
  display: block;
}

.brand span,
.tenant-card span,
.tenant-card small {
  color: rgba(255, 255, 255, 0.68);
}

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

.nav-item {
  border-radius: 8px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover,
.nav-item:focus-visible {
  background: rgba(255, 255, 255, 0.11);
  color: white;
  outline: none;
}

.tenant-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.tenant-card strong {
  margin: 6px 0;
}

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

.demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(157, 93, 0, 0.22);
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff8ea;
  color: #563200;
}

.demo-banner strong,
.demo-banner span {
  display: block;
}

.demo-banner span {
  margin-top: 3px;
  color: #704400;
  font-size: 0.92rem;
}

.demo-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.signed-in-user {
  color: #704400;
  font-size: 0.86rem;
  font-weight: 700;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 2.5vw, 2.35rem);
  letter-spacing: 0;
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.topbar-actions,
.form-actions,
.filters,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.secondary-button,
.text-button,
.table-link {
  border-radius: 8px;
  font-weight: 700;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  padding: 9px 12px;
}

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

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-strong);
}

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

.text-button,
.table-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.workflow-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workflow-card:hover,
.workflow-card:focus-visible {
  border-color: rgba(17, 98, 79, 0.4);
  outline: none;
}

.workflow-card span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.workflow-card p {
  grid-column: 2;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi {
  display: grid;
  gap: 4px;
  min-height: 112px;
  padding: 15px;
}

.kpi span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.kpi strong {
  display: block;
  margin: 2px 0;
  color: var(--text);
  font-size: 2.15rem;
  line-height: 1;
}

.kpi small {
  color: var(--muted);
  font-size: 0.88rem;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel + .panel {
  margin-top: 16px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.88rem;
}

.chart {
  display: grid;
  grid-template-columns: repeat(5, minmax(34px, 1fr));
  align-items: end;
  gap: 10px;
  height: 230px;
  padding-top: 16px;
}

.bar {
  display: flex;
  min-height: 28px;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
}

.bar-fill {
  min-height: 8px;
  border-radius: 8px 8px 0 0;
  background: var(--accent);
}

.bar span {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.signal-list,
.actions-list,
.review-list,
.persona-list,
.testing-checklist {
  display: grid;
  gap: 12px;
}

.school-license-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.signal,
.action-item,
.review-item,
.empty-state,
.school-card,
.persona-card,
.test-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  padding: 12px;
  background: var(--surface-soft);
}

.signal strong,
.action-item strong,
.review-item strong,
.empty-state strong,
.school-card strong,
.persona-card strong,
.test-card strong {
  display: block;
  margin-bottom: 3px;
}

.signal p,
.action-item p,
.review-item p,
.assistant-output p,
.empty-state p,
.school-card p,
.persona-card p,
.test-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.school-card-heading,
.test-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.school-card-heading {
  display: grid;
}

.school-card-heading .badge {
  justify-self: start;
}

.school-card-meta,
.school-card-stats {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.school-card-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 6px;
}

.school-card-stats .badge {
  grid-column: 1 / -1;
  justify-self: start;
}

.persona-card {
  display: grid;
  gap: 3px;
}

.persona-card small {
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.persona-card span {
  margin-top: 5px;
  color: #34423f;
  font-size: 0.9rem;
  line-height: 1.45;
}

.test-intro {
  border: 1px solid rgba(157, 93, 0, 0.28);
  border-radius: 8px;
  padding: 14px;
  background: var(--warning-soft);
}

.test-intro p {
  margin: 8px 0 0;
  color: #704400;
}

.test-card-heading {
  align-items: center;
}

.test-card-heading > span {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.test-card ol {
  margin: 12px 0;
  padding-left: 22px;
}

.test-card li {
  margin-bottom: 8px;
}

.expected-result {
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.expected-result p {
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  max-width: 100%;
  padding: 4px 8px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.neutral {
  background: #edf1f0;
  color: #44524f;
}

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

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

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

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  font-size: 0.94rem;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 16px;
}

.report-panel {
  min-height: 620px;
  scroll-margin-top: 14px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  margin-bottom: 20px;
  background: #e8eeee;
}

.progress div {
  width: 14%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  color: #34423f;
  font-weight: 700;
}

.field small {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.field input,
.field textarea,
.field select,
.filters select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
}

.field textarea {
  min-height: 170px;
  resize: vertical;
}

.upload-box {
  display: grid;
  gap: 8px;
  border: 1px dashed rgba(17, 98, 79, 0.45);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

.upload-box strong {
  color: var(--text);
}

.upload-box input {
  width: 100%;
}

.file-list {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.photo-thumb {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.photo-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-thumb figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.photo-thumb figcaption span {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.choice-grid-stacked {
  grid-template-columns: 1fr;
}

.choice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
  text-align: left;
}

.choice.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice p {
  margin-bottom: 0;
  color: var(--muted);
}

.choice-grid-stacked .choice {
  display: grid;
  grid-template-columns: minmax(110px, 150px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.assistant-panel {
  position: sticky;
  top: 20px;
  align-self: start;
  padding: 14px;
}

.assistant-panel .panel-heading {
  margin-bottom: 10px;
}

.assistant-panel .panel-heading span {
  display: none;
}

.assistant-output {
  display: grid;
  gap: 12px;
}

.assistant-note {
  border-left: 3px solid var(--accent);
  padding: 10px;
  border-radius: 0 8px 8px 0;
  background: var(--accent-soft);
  font-size: 0.9rem;
}

.ai-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.ai-box p,
.ai-box ul {
  margin-bottom: 0;
}

.editable-list {
  gap: 14px;
}

.editable-row,
.action-editor,
.evidence-box {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.editable-row .field,
.action-editor .field,
.evidence-note {
  margin-bottom: 0;
}

.compact-fields .field textarea {
  min-height: 90px;
}

.evidence-note textarea {
  min-height: 95px;
}

.evidence-warning {
  color: var(--warning);
  font-weight: 700;
}

.control-list {
  display: grid;
  gap: 14px;
}

.control-list.compact {
  gap: 10px;
}

.control-group {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

.control-group h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.control-question {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.control-question > .field {
  margin-bottom: 0;
}

.control-check {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.control-check header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.control-check strong {
  margin-bottom: 0;
}

.control-check p {
  margin-bottom: 0;
  color: var(--muted);
}

.evidence-summary {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  padding: 8px;
  border-radius: 8px;
  background: white;
}

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

.action-meta,
.review-meta,
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.detail-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

.detail-block h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.detail-block p:last-child {
  margin-bottom: 0;
}

.report-output article {
  max-width: 920px;
}

.report-output h3 {
  margin: 24px 0 8px;
}

.report-output li {
  margin-bottom: 7px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  transform: translateY(20px);
  border-radius: 8px;
  padding: 12px 14px;
  background: #102520;
  color: white;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

  .sidebar {
    position: static;
  }

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

  .content-grid,
  .report-layout,
  .two-col,
  .detail-grid,
  .workflow-strip,
  .kpi-grid,
  .school-license-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .demo-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .demo-actions {
    justify-content: flex-start;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }
}

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

  .nav {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .form-actions,
  .inline-actions,
  .demo-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .school-card-heading,
  .test-card-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .school-card-stats {
    grid-template-columns: 1fr;
  }

  .choice-grid-stacked .choice {
    grid-template-columns: 1fr;
  }
}
