:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-strong: #f8fafb;
  --ink: #282828;
  --muted: #66717a;
  --subtle: #e2e6e9;
  --line: #d4dade;
  --accent: #9a233f;
  --accent-strong: #7d1931;
  --school-blue: #3a8ecc;
  --school-blue-soft: #e7f3fb;
  --green: #24785a;
  --red: #aa3f3f;
  --amber: #a36d1d;
  --blue: #325f9e;
  --shadow: 0 5px 18px rgba(40, 40, 40, 0.06);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color: var(--ink);
  font-family:
    "Open Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}

body {
  margin: 0;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: #282828;
  color: #eef5f7;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: grid;
  gap: 14px;
  padding: 2px 4px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand img {
  width: 218px;
  height: 62px;
  object-fit: contain;
  object-position: left center;
}

.product-name {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: white;
  font-weight: 700;
}

.environment-tag {
  color: white;
  background: #9a233f;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0;
}

.sidebar .eyebrow {
  color: #9fb0bf;
}

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

.nav-item {
  color: #dfe8ee;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(58, 142, 204, 0.18);
  border-color: rgba(58, 142, 204, 0.42);
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--school-blue);
}

.sync-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.sync-card strong,
.sync-card span {
  display: block;
}

.sync-card small {
  display: block;
  color: #99a5ad;
  margin-top: 9px;
}

.sync-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: #65c996;
  box-shadow: 0 0 0 3px rgba(101, 201, 150, 0.14);
}

.sync-card span {
  color: #c5d0da;
  margin-top: 4px;
  font-size: 0.9rem;
}

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

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

.topbar h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2vw, 2.2rem);
  font-family: Utopia, Georgia, "Times New Roman", serif;
  color: var(--accent);
}

.topbar-actions,
.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.data-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--school-blue-soft);
  border: 1px solid #b8d9ee;
}

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

.data-banner span {
  color: #405d70;
  margin-top: 4px;
}

.view {
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

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

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

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

.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--subtle);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.panel-header h3,
.panel-header p,
.metric p,
.metric strong {
  margin: 0;
}

.panel-header h3,
.document-preview h2,
.document-preview h3 {
  font-family: Utopia, Georgia, "Times New Roman", serif;
  color: #282828;
}

.panel-header p {
  color: var(--muted);
  margin-top: 4px;
}

.panel-body {
  padding: 18px;
}

.metric {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.7rem;
}

.metric span {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.queue-item,
.pupil-card,
.provision-card,
.review-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
  background: var(--panel-strong);
}

.queue-item {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.title-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.title-row h4 {
  margin: 0;
}

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

.small {
  font-size: 0.9rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 750;
  background: #e7edf2;
  color: #32485d;
  white-space: nowrap;
}

.status-pill.live {
  background: #dff1e9;
  color: var(--green);
}

.status-pill.synthetic {
  background: #ddecf6;
  color: #235f87;
}

.status-pill.stale,
.status-pill.draft {
  background: #f3e3ca;
  color: var(--amber);
}

.status-pill.warning,
.status-pill.review {
  background: #f4dbdb;
  color: var(--red);
}

.status-pill.published,
.status-pill.active {
  background: #e9f4fb;
  color: #246b9d;
}

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

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

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

.secondary-button {
  background: #edf6fb;
  color: #246b9d;
  border-color: #b9d9ec;
}

.ghost-button {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  background: #fff0f0;
  color: var(--red);
  border-color: #e5b4b4;
}

.icon-button {
  width: 38px;
  padding: 0;
  background: #f3f7fa;
  border-color: var(--line);
  font-size: 1.3rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  background: #f4f7f9;
  color: #394c5e;
  font-size: 0.88rem;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.search,
select,
textarea,
input {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--ink);
}

.search {
  min-width: min(360px, 100%);
}

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

.pupil-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1.25fr);
  gap: 18px;
  align-items: start;
}

.pupil-identity {
  display: flex;
  gap: 14px;
  align-items: center;
}

.avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7f3fb;
  color: #216c9e;
  font-weight: 850;
}

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

.evidence-card {
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
}

.evidence-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.25rem;
}

.builder {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
}

.steps {
  display: grid;
  gap: 8px;
  align-self: start;
  position: sticky;
  top: 24px;
}

.step-button {
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.step-button.active {
  border-color: var(--school-blue);
  box-shadow: inset 3px 0 0 var(--school-blue);
}

.check-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.check-list li {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: #f7fafc;
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
}

.suggestion {
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
}

.suggestion + .suggestion {
  margin-top: 10px;
}

.suggestion footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

.mini-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 24, 35, 0.55);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 40;
}

.dialog {
  width: min(880px, 100%);
  max-height: min(760px, 90vh);
  overflow: auto;
  background: white;
  border-radius: 10px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
}

.dialog-header {
  position: sticky;
  top: 0;
  background: white;
  border-bottom: 1px solid var(--subtle);
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  z-index: 1;
}

.dialog-header h2 {
  margin: 0;
}

#modalBody {
  padding: 18px;
}

.document-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 780px;
}

.document-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 4px solid var(--accent);
}

.document-brand img {
  width: 210px;
  max-height: 72px;
  object-fit: contain;
  object-position: left center;
}

.document-brand strong {
  color: var(--accent);
  font-family: Utopia, Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
}

.operational-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.operational-item {
  padding: 11px 13px;
  background: white;
}

.operational-item span,
.operational-item strong {
  display: block;
}

.operational-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.operational-item strong {
  margin-top: 3px;
  font-size: 0.92rem;
}

.document-preview h2,
.document-preview h3 {
  margin-top: 0;
}

.doc-section {
  border-top: 1px solid var(--subtle);
  padding-top: 16px;
  margin-top: 16px;
}

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

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

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

  .grid.two,
  .grid.three,
  .grid.four,
  .pupil-layout,
  .builder {
    grid-template-columns: 1fr;
  }

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

  .steps {
    position: static;
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 16px;
  }

  .topbar,
  .data-banner,
  .queue-item {
    align-items: stretch;
    flex-direction: column;
    display: flex;
  }

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