* {
  box-sizing: border-box;
}

:root {
  --ink: #17211f;
  --muted: #5d6a66;
  --line: #d8ded7;
  --paper: #fffdf8;
  --wash: #f3f5ef;
  --green: #1f6a5d;
  --green-dark: #163c36;
  --blue: #2f6687;
  --yellow: #f1c94b;
  --red: #b94635;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--wash);
}

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

button,
a {
  min-height: 40px;
  border-radius: 6px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 44px);
  background: var(--green-dark);
  color: #fff;
  border-bottom: 4px solid var(--yellow);
}

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

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 6px;
}

.brand p,
.brand h1,
.eyebrow,
.quiet,
#loginStatus,
#saveStatus {
  margin: 0;
}

.brand p,
.eyebrow {
  color: #d6e7df;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.35rem, 2.6vw, 2rem);
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.02rem;
}

h4 {
  font-size: .95rem;
  margin-bottom: 8px;
}

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

.top-actions a,
.top-actions button,
form button {
  border: 1px solid transparent;
  background: #fff;
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 800;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.top-actions button {
  background: transparent;
  border-color: rgba(255, 255, 255, .45);
  color: #fff;
}

main {
  padding: 24px clamp(16px, 4vw, 44px) 44px;
}

.login-panel {
  max-width: 720px;
  margin: 48px auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 4vw, 32px);
  display: grid;
  gap: 20px;
}

.quiet {
  color: var(--muted);
  line-height: 1.5;
}

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

label {
  display: grid;
  gap: 6px;
}

label span {
  font-weight: 800;
  font-size: .9rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bcc8c1;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

form button {
  justify-self: start;
  background: var(--green);
  color: #fff;
  min-width: 130px;
}

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

.metric {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric strong {
  display: block;
  font-size: 1.45rem;
}

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

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.page-list,
.review-surface,
.panel,
.review-form {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.page-list {
  padding: 14px;
  position: sticky;
  top: 16px;
}

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

.aside-title span {
  color: var(--muted);
  font-size: .86rem;
}

.page-button {
  width: 100%;
  min-height: 76px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.page-button + .page-button {
  margin-top: 8px;
}

.page-button.active {
  border-color: var(--green);
  box-shadow: inset 4px 0 0 var(--green);
}

.page-button strong,
.page-button small {
  display: block;
}

.page-button small {
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.35;
}

.page-button em {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  font-style: normal;
  font-size: .78rem;
  font-weight: 800;
}

.page-button em.open {
  background: #eef1ed;
  color: var(--muted);
}

.page-button em.needs {
  background: #fff4ce;
  color: #755400;
}

.page-button em.ok {
  background: #dff2e8;
  color: #16503d;
}

.page-button em.stop {
  background: #fbe4de;
  color: #8e2d22;
}

.review-surface {
  padding: 16px;
}

.detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  margin-bottom: 16px;
}

.detail-header .eyebrow {
  color: var(--blue);
  margin-bottom: 6px;
}

.status-box {
  display: grid;
  gap: 8px;
  min-width: 190px;
}

.status-box span {
  display: block;
  background: #eef6f3;
  border: 1px solid #c9ddd5;
  border-radius: 6px;
  padding: 8px 10px;
  font-weight: 800;
  color: var(--green-dark);
}

.status-box span + span {
  background: #fff4ce;
  border-color: #ead58d;
  color: #735409;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr);
  gap: 16px;
}

.panel {
  padding: 16px;
}

.section-block {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.section-block p,
.section-block ul,
.question-list {
  margin: 0;
  line-height: 1.5;
}

ul {
  padding-left: 20px;
}

li + li {
  margin-top: 8px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}

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

th {
  background: #edf4f1;
}

.checker-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.checker-strip span {
  color: var(--muted);
  font-weight: 800;
}

.checker-strip strong {
  border: 1px solid #d7c365;
  background: #fff7d7;
  border-radius: 999px;
  padding: 4px 8px;
}

.review-form {
  margin-top: 16px;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.review-form h3,
.field.wide,
.form-actions {
  grid-column: 1 / -1;
}

.report-box {
  min-height: 300px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .92rem;
}

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

#loginStatus,
#saveStatus {
  color: var(--red);
  font-weight: 800;
}

@media (max-width: 980px) {
  .workspace,
  .two-column,
  .detail-header,
  .review-form {
    grid-template-columns: 1fr;
  }

  .page-list {
    position: static;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .page-button {
    align-items: flex-start;
    flex-direction: column;
  }
}
