body { font-family: Arial, sans-serif; background: #f7f7f7; margin: 0; color: #222; }
header { background: #192231; color: white; padding: 18px 28px; }
header h1 { margin: 0; font-size: 24px; }
nav a { color: white; margin-right: 16px; text-decoration: none; }
.container { max-width: 1180px; margin: 24px auto; background: white; padding: 24px; box-shadow: 0 1px 6px rgba(0,0,0,.12); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card { border: 1px solid #ddd; padding: 16px; margin-bottom: 18px; border-radius: 6px; background: #fff; }
label { display: block; font-weight: bold; margin-top: 10px; }
input, select, textarea { width: 100%; padding: 8px; margin-top: 4px; border: 1px solid #bbb; border-radius: 4px; box-sizing: border-box; }
button, .button { background: #25364c; color: white; border: none; padding: 10px 14px; border-radius: 4px; margin-top: 12px; cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary, .button.secondary { background: #666; }
button.danger { background: #9b2d2d; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; vertical-align: top; }
th { background: #eef1f5; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 12px; color: white; font-size: 12px; }
.buy { background: #246b36; }
.watch { background: #a66a00; }
.pass { background: #9b2d2d; }
.pre { white-space: pre-wrap; background: #f3f3f3; padding: 12px; border-radius: 4px; }
.small { font-size: 12px; color: #666; }
.alert { padding: 10px 12px; border-left: 4px solid #a66a00; background: #fff6e6; }

/* v6.1 UI improvements */
.header-row, .page-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.version-pill { display: inline-block; padding: 3px 8px; border-radius: 999px; background: #e8eef8; color: #26415f; font-size: 0.55em; vertical-align: middle; }
.muted { color: #777; }
.button.secondary, a.button.secondary { background: #eef2f6; color: #1f3347; border: 1px solid #cbd5df; }
.documents-table td { vertical-align: top; }
.filename-cell { max-width: 220px; overflow-wrap: anywhere; }
.action-cell { min-width: 220px; }
.summary-details { margin: 4px 0 8px 0; }
.summary-details summary, .editor-details summary { cursor: pointer; font-weight: 700; color: #26415f; }
.summary-preview { max-height: 280px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.thesis-tools { margin: 8px 0 12px 0; }
.editor-details { margin: 10px 0; }
.full-summary-card { max-width: 1100px; }
.full-summary { white-space: pre-wrap; overflow-wrap: anywhere; max-height: none; }

.workflow-pill { display:inline-block; padding:4px 8px; border-radius:10px; background:#eef1f5; }
.muted { color:#777; }

/* v6.3.2 document accordion and ACFR workflow refinements */
.doc-accordion-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.doc-accordion { border: 1px solid #d9dee6; border-radius: 6px; background: #fff; }
.doc-accordion > summary { cursor: pointer; list-style: none; padding: 12px 14px; display: grid; grid-template-columns: 170px 1fr 120px; gap: 12px; align-items: center; font-weight: 700; color: #192231; }
.doc-accordion > summary::-webkit-details-marker { display: none; }
.doc-accordion > summary:before { content: "▶"; margin-right: 6px; color: #26415f; }
.doc-accordion[open] > summary:before { content: "▼"; }
.doc-summary-file { font-weight: 500; color: #444; overflow-wrap: anywhere; }
.doc-status { font-size: 12px; padding: 4px 6px; border-radius: 10px; background: #eef2f6; text-align: center; }
.doc-accordion-body { border-top: 1px solid #e5e8ee; padding: 12px 14px 14px 14px; }
.doc-meta-grid { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 10px; margin-bottom: 12px; font-size: 13px; }
.doc-actions { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.doc-actions form { margin: 0; }
@media (max-width: 900px) {
  .doc-accordion > summary { grid-template-columns: 1fr; }
  .doc-meta-grid { grid-template-columns: 1fr; }
}

.danger-zone { margin-top: 12px; border-top: 1px solid #eee; padding-top: 10px; }
.danger-zone summary { color: #9b2d2d; }
button.danger, .button.danger { background: #9b2d2d; }

/* v6.3.6 section accordions and report-polish UI */
.section-accordion { padding: 0; overflow: hidden; }
.section-accordion > .section-summary { cursor: pointer; padding: 16px; font-size: 18px; font-weight: 700; background: #f5f7fa; border-bottom: 1px solid #dfe5ed; display: flex; align-items: center; gap: 8px; }
.section-accordion[open] > .section-summary { background: #eef3f8; }
.section-accordion > *:not(.section-summary) { margin-left: 16px; margin-right: 16px; }
.count-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #dde6f0; color: #25364c; font-size: 12px; font-weight: 700; }
.table-scroll { overflow-x: auto; }
.compact-table { max-width: 620px; }
.trend-table th, .trend-table td { white-space: nowrap; font-size: 13px; }
.finding-groups { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 16px; }
.finding-group { border: 1px solid #d9dee6; border-radius: 6px; background: #fff; }
.finding-group > summary { cursor: pointer; padding: 12px 14px; font-weight: 700; color: #192231; background: #f7f9fb; }
.finding-item { border-top: 1px solid #edf0f4; }
.finding-item > summary { cursor: pointer; padding: 10px 14px; display: grid; grid-template-columns: 190px 80px 1fr; gap: 12px; align-items: center; }
.finding-form { padding: 12px 14px 16px; background: #fff; }
.risk-pill { display: inline-block; text-align: center; padding: 3px 8px; border-radius: 10px; color: white; font-size: 12px; }
.risk-low { background: #246b36; }
.risk-medium { background: #a66a00; }
.risk-high { background: #9b4d00; }
.risk-severe { background: #9b2d2d; }
.audit-item { border-top: 1px solid #edf0f4; padding: 8px 0; }
.audit-item > summary { cursor: pointer; }
.doc-summary-file a { color: #26415f; text-decoration: underline; }
.doc-summary-file a:hover { color: #111; }
@media (max-width: 900px) {
  .finding-item > summary { grid-template-columns: 1fr; }
}

/* v6.3.7 accordion refinements */
details.section-accordion > summary.section-summary,
details.doc-accordion > summary,
details.finding-group > summary,
details.finding-item > summary,
details.summary-details > summary,
details.audit-item > summary,
details.editor-details > summary,
details.danger-zone > summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  padding-left: 24px;
}

details.section-accordion > summary.section-summary::-webkit-details-marker,
details.doc-accordion > summary::-webkit-details-marker,
details.finding-group > summary::-webkit-details-marker,
details.finding-item > summary::-webkit-details-marker,
details.summary-details > summary::-webkit-details-marker,
details.audit-item > summary::-webkit-details-marker,
details.editor-details > summary::-webkit-details-marker,
details.danger-zone > summary::-webkit-details-marker {
  display: none;
}

details.section-accordion > summary.section-summary::before,
details.doc-accordion > summary::before,
details.finding-group > summary::before,
details.finding-item > summary::before,
details.summary-details > summary::before,
details.audit-item > summary::before,
details.editor-details > summary::before,
details.danger-zone > summary::before {
  content: "▸";
  position: absolute;
  left: 2px;
  top: 0;
  font-weight: bold;
  transition: transform .12s ease-in-out;
}

details.section-accordion[open] > summary.section-summary::before,
details.doc-accordion[open] > summary::before,
details.finding-group[open] > summary::before,
details.finding-item[open] > summary::before,
details.summary-details[open] > summary::before,
details.audit-item[open] > summary::before,
details.editor-details[open] > summary::before,
details.danger-zone[open] > summary::before {
  content: "▾";
}

.section-summary {
  font-size: 18px;
  font-weight: 700;
}

.muted {
  color: #666;
}

.doc-accordion, .finding-group, .finding-item, .audit-item {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
  margin: 10px 0;
  background: #fff;
}

.doc-accordion[open], .finding-group[open], .finding-item[open], .audit-item[open] {
  background: #fbfbfb;
}

.info-box {
  border: 1px solid #d8e0ea;
  background: #f8fbff;
  border-radius: 6px;
  padding: 12px 14px;
  margin: 10px 0 14px;
}

.info-box ul {
  margin-top: 6px;
}

code {
  background: #eef1f5;
  border-radius: 4px;
  padding: 1px 4px;
}

.warning-text { color: #8a5a00; background: #fff8e5; border-left: 4px solid #d39a20; padding: 8px 10px; border-radius: 4px; }

.answer-box {
  border: 1px solid #c8d6e5;
  background: #f5f9ff;
  padding: 14px;
  border-radius: 6px;
  margin: 14px 0;
}
.answer-box h4 {
  margin-top: 0;
}
.ai-answer-preview {
  max-height: 520px;
  overflow: auto;
  background: #fff;
}
.ai-question-form button[type="submit"]::after {
  content: "";
}


/* v6.5 Mentor / Protege workflow */
.mentor-subsection, .mentor-note {
  border: 1px solid #d9e1ea;
  border-radius: 6px;
  padding: 10px;
  margin: 10px 0;
  background: #fff;
}
.mentor-note[open] { background: #f8fbff; }
.mentor-subsection summary, .mentor-note summary { cursor: pointer; font-weight: 700; }
.secondary { background: #666 !important; }

/* v6.6.0 State Temporary Funding Impact Dashboard */
.impact-summary-grid { grid-template-columns: repeat(4, 1fr); }
.metric-card { text-align: center; }
.metric-card h3 { font-size: 30px; margin: 4px 0; color: #25364c; }
.metric-card p { margin: 0; color: #666; }
.review-picker-list { max-height: 320px; overflow: auto; border: 1px solid #e1e5eb; border-radius: 6px; padding: 8px; background: #fbfcfe; }
.checkbox-row { display: flex; align-items: flex-start; gap: 8px; font-weight: normal; margin: 8px 0; }
.checkbox-row input { width: auto; margin-top: 2px; }
.impact-table td, .impact-table th { font-size: 12px; }
.risk-view { display: inline-block; padding: 3px 8px; border-radius: 10px; color: white; font-size: 12px; white-space: nowrap; }
.risk-view.watch { background: #a66a00; }
.risk-view.needs-review { background: #6b5b95; }
.risk-view.lower-concern { background: #246b36; }
.risk-view.needs-data { background: #666; }
@media (max-width: 900px) { .impact-summary-grid { grid-template-columns: 1fr; } }
