:root {
  color-scheme: light;
  --institutional: #006847;
  --institutional-dark: #004c3f;
  --wine: #6a1c43;
  --paper: #f4f5f4;
  --white: #ffffff;
  --ink: #282828;
  --muted: #5f6966;
  --line: #d5dbd8;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}

button, input, textarea { font: inherit; }

button {
  min-height: 44px;
  padding: .65rem 1.1rem;
  border: 2px solid var(--institutional);
  border-radius: 2px;
  background: var(--institutional);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
}

button:hover { border-color: var(--institutional-dark); background: var(--institutional-dark); }
button:disabled { cursor: wait; opacity: .65; }

button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--wine);
  outline-offset: 3px;
}

h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 0; color: var(--institutional-dark); font-size: clamp(1.35rem, 3vw, 1.7rem); line-height: 1.2; }
h2 { margin-bottom: .5rem; color: var(--institutional-dark); font-size: clamp(1.55rem, 4vw, 2rem); line-height: 1.2; }
h3 { color: var(--institutional-dark); font-size: 1.1rem; }
h4 { margin-bottom: 0; color: var(--institutional-dark); }
a { color: var(--institutional-dark); }

.institution-name, .eyebrow, .report-type {
  margin-bottom: .2rem;
  color: var(--institutional);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { top: .75rem; left: .75rem; z-index: 5; padding: .5rem; background: var(--white); }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem max(1rem, calc((100vw - 1040px) / 2));
  border-top: 7px solid var(--institutional);
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.button-secondary { background: transparent; color: var(--institutional-dark); }
.page-shell { width: min(1040px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 4rem; }
.intro { max-width: 780px; margin-bottom: 1.5rem; }
.intro > p { margin-bottom: 1rem; color: var(--muted); }

.connection-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem .75rem;
  padding: .65rem .8rem;
  border: 1px solid var(--line);
  border-left: 4px solid #8a9591;
  background: var(--white);
  font-size: .84rem;
}

.connection-status.connected { border-left-color: var(--institutional); }
.connection-status.disconnected { border-left-color: var(--wine); }
.connection-dot { width: .55rem; height: .55rem; flex: 0 0 auto; border-radius: 50%; background: #8a9591; }
.connected .connection-dot { background: var(--institutional); }
.disconnected .connection-dot { background: var(--wine); }
.codex-usage { padding-left: .75rem; border-left: 1px solid var(--line); font-weight: 700; }
.connection-account { width: 100%; padding-left: 1.3rem; color: var(--muted); font-size: .78rem; }

.workspace, .report, .login-card {
  border: 1px solid var(--line);
  border-top: 4px solid var(--institutional);
  background: var(--white);
}

.workspace { padding: clamp(1rem, 4vw, 1.75rem); }
.field-heading, .report-header, .proposal-heading, .criterion-heading, .finding-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

label { display: block; color: var(--institutional-dark); font-weight: 700; }
#counter { color: var(--muted); font-size: .82rem; }

input, textarea {
  width: 100%;
  border: 1px solid #87958f;
  border-radius: 2px;
  background: var(--white);
  color: var(--ink);
}

input { min-height: 46px; padding: .65rem .75rem; }
textarea { display: block; margin: .5rem 0 .75rem; padding: .9rem; line-height: 1.5; resize: vertical; }
.privacy-note { margin: 0 0 1rem; color: var(--muted); font-size: .82rem; }
.status { margin-top: 1rem; padding: .8rem; border: 1px solid var(--line); }
.status p { margin-bottom: 0; }
.status.loading { border-left: 4px solid var(--institutional); background: #f1f8f5; }
.alert.error, .status.error { border: 1px solid var(--wine); background: #fbf3f7; color: #571636; }
progress { width: 100%; height: .55rem; margin-top: .65rem; accent-color: var(--institutional); }

.report { margin-top: 1.5rem; padding: clamp(1rem, 4vw, 1.75rem); }
.report > section { padding-top: 1.25rem; border-top: 1px solid var(--line); }
.technical-note { color: var(--muted); font-size: .78rem; text-align: right; }
.conclusion { max-width: 820px; font-size: 1.05rem; }
.criteria-grid { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--line); }
.criterion-card { padding: .85rem; }
.criterion-card:nth-child(odd) { border-right: 1px solid var(--line); }
.criterion-card:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
.criterion-card p, .article-item p { margin: .5rem 0 0; }
.badge { flex: 0 0 auto; padding: .15rem .45rem; border-radius: 2px; font-size: .72rem; font-weight: 700; }
.state-ok { background: #dcefe7; color: #0b4f3b; }
.state-partial { background: #f4edd4; color: #5f4c09; }
.state-bad { background: #f2dce6; color: #68193d; }
.state-unknown { background: #e7eae9; color: #3f4845; }
.findings, .articles { display: grid; gap: .75rem; }
.finding-card, .article-item { padding: .85rem 0; border-bottom: 1px solid var(--line); }
.finding-card p:last-child { margin-bottom: 0; }
.finding-improvement { padding-left: .75rem; border-left: 3px solid var(--institutional); }
.article-item strong { color: var(--wine); }
.proposal pre { overflow-x: auto; padding: 1rem; border: 1px solid var(--line); background: #fafafa; color: var(--ink); font-family: Arial, Helvetica, sans-serif; white-space: pre-wrap; }
.copy-status { min-height: 1.5rem; color: var(--institutional); font-weight: 700; }

.login-page { min-height: 100vh; border-top: 7px solid var(--institutional); }
.login-shell { display: grid; min-height: calc(100vh - 7px); place-items: center; padding: 1rem; }
.login-card { width: min(420px, 100%); padding: clamp(1.25rem, 6vw, 2rem); }
.lede { color: var(--muted); }
.stack { display: grid; gap: .6rem; }
.stack button { margin-top: .5rem; }
.alert { margin-bottom: 1rem; padding: .75rem; }

footer { padding: 1.25rem 1rem; border-top: 1px solid var(--line); background: var(--white); color: var(--muted); text-align: center; font-size: .8rem; }

@media (max-width: 650px) {
  .site-header { align-items: flex-start; }
  .site-header h1 { max-width: 190px; }
  .institution-name { max-width: 220px; }
  .page-shell { width: min(100% - 1rem, 1040px); padding-top: 1.25rem; }
  .criteria-grid { grid-template-columns: 1fr; }
  .criterion-card:nth-child(odd) { border-right: 0; }
  .criterion-card:not(:last-child) { border-bottom: 1px solid var(--line); }
  .report-header, .finding-heading, .proposal-heading { align-items: flex-start; flex-direction: column; }
  .technical-note { text-align: left; }
  .proposal-heading button { width: 100%; }
  .codex-usage { width: 100%; padding: .4rem 0 0 1.3rem; border-top: 1px solid var(--line); border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
