* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f5f7;
  color: #20252b;
}

header {
  height: 88px;
  padding: 18px 32px;
  background: #ffffff;
  border-bottom: 1px solid #d9dde2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  margin: 0;
  font-size: 26px;
}

header p {
  margin: 5px 0 0;
  color: #66707a;
}

.jurisdiction {
  font-weight: 600;
  color: #4e5964;
}

.agency-branding {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.agency-branding img {
  height: 85px;
  max-height: 90px;
  min-height: 80px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}

@media (max-width: 640px) {
  .agency-branding img {
    height: 48px;
    min-height: 0;
  }
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 32px 60px;
}

.source-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 20px;
}

.page-heading-content {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #69737d;
}

.source-heading h3 {
  margin: 4px 0 2px;
  font-size: 20px;
  line-height: 1.25;
}

.source-heading p {
  margin: 0;
  color: #69737d;
}

.open-source {
  flex-shrink: 0;
  padding: 10px 14px;
  border: 1px solid #c9cfd6;
  border-radius: 6px;
  background: #ffffff;
  color: #20252b;
  text-decoration: none;
}

.open-source:hover {
  background: #f7f8f9;
}

.knowledge-view {
  background: #ffffff;
  border: 1px solid #cfd4da;
  border-radius: 8px;
  overflow: hidden;
}

.knowledge-toolbar {
  padding: 14px 22px;
  border-bottom: 1px solid #d9dde2;
}

.knowledge-toolbar strong {
  display: block;
  font-size: 16px;
}

.knowledge-toolbar span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: #69737d;
}

.markdown-content {
  padding: 32px 42px 60px;
  line-height: 1.55;
}

.markdown-content h1 {
  margin: 0 0 30px;
  font-size: 25px;
}

.markdown-content h2 {
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e1e4e8;
  font-size: 20px;
}

.markdown-content h3 {
  margin: 24px 0 10px;
  font-size: 16px;
}

.markdown-content p {
  margin: 0 0 14px;
  font-size: 16px;
}

.source-reference {
  margin: -3px 0 22px;
  font-size: 13px;
  color: #69737d;
}

.source-reference a {
  margin-left: 10px;
  color: #334e68;
  text-decoration: none;
}

.source-reference a:hover {
  text-decoration: underline;
}

/* Prototype 2B — question and retrieval */

.question-panel {
  margin-bottom: 30px;
  padding: 24px 28px;
  background: #ffffff;
  border: 1px solid #cfd4da;
  border-radius: 8px;
}

.question-panel label {
  display: block;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 700;
}

.question-row {
  display: flex;
  gap: 10px;
}

.question-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #bfc6ce;
  border-radius: 6px;
  font: inherit;
  font-size: 16px;
}

.question-row input:focus {
  outline: 2px solid #64798d;
  outline-offset: 1px;
}

.question-row button {
  padding: 12px 22px;
  border: 1px solid #34495e;
  border-radius: 6px;
  background: #34495e;
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.question-row button:hover {
  background: #293d50;
}

.ask-another-row {
  margin-top: 12px;
}

#ask-another-button {
  padding: 12px 22px;
  border: 1px solid #34495e;
  border-radius: 6px;
  background: #ffffff;
  color: #34495e;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  visibility: hidden;
}

#ask-another-button.is-visible {
  visibility: visible;
}

#ask-another-button:hover {
  background: #f0f3f6;
}

#ask-another-button:focus-visible {
  outline: 2px solid #64798d;
  outline-offset: 1px;
}

.prototype-note {
  margin: 9px 0 0;
  font-size: 13px;
  color: #69737d;
}

.evidence-section + .evidence-section {
  margin-top: 42px;
  padding-top: 8px;
  border-top: 1px solid #e1e4e8;
}

.evidence-section h2 {
  margin-top: 0;
}

.no-evidence {
  padding: 10px 0 20px;
}

.no-evidence h2 {
  margin-top: 0;
}

@media (max-width: 700px) {
  .question-row {
    flex-direction: column;
  }

  .question-row button {
    width: 100%;
  }
}
header {
  background: #1f3864;
  color: #ffffff;
}

header h1,
header p,
header .jurisdiction {
  color: #ffffff;
}

/* Phase J3A: login, session controls, admin user administration */

.session-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.session-controls form {
  margin: 0;
}

.login-page {
  max-width: 560px;
  margin: 72px auto;
  padding: 32px;
  background: #ffffff;
  border: 1px solid #d9dde2;
  border-top: 4px solid #1f3864;
  border-radius: 8px;
}

.login-page h1 {
  margin: -32px -32px 20px;
  padding: 18px 32px;
  background: #1f3864;
  border-radius: 4px 4px 0 0;
  font-size: 26px;
  color: #ffffff;
}

.login-subheading {
  margin: 0 0 20px;
  color: #66707a;
}

.login-form {
  margin-top: 20px;
}

.login-form label {
  display: block;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 700;
}

/* main.admin-page (not just .admin-page) so this always wins over the
   generic `main { max-width: 1100px; padding: 28px 32px 60px; }` rule
   above regardless of any future reordering -- class specificity alone
   already wins today, but pinning the element too removes any doubt. */
main.admin-page {
  width: 90vw;
  max-width: 90vw;
  margin: 48px auto;
  padding: 24px;
  background: #ffffff;
  border: 1px solid #d9dde2;
  border-radius: 8px;
  box-sizing: border-box;
}

.demo-security-notice {
  margin: 0;
  background: #f4f7fa;
  border: 1px solid #d9dde2;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  color: #4e5964;
}

.login-error {
  margin: 16px 0 0;
  padding: 10px 14px;
  background: #fdeeee;
  border: 1px solid #e3b4b4;
  border-radius: 6px;
  font-size: 14px;
  color: #b02a2a;
}

.admin-message {
  color: #205c2e;
  font-weight: bold;
}

/* The table used to rely on the browser's default table-layout: auto,
   which sizes columns from cell content -- with several short (Agency,
   Role, Active) and several long (Actions' three button-forms) columns
   competing, that algorithm gave Actions most of the width and squeezed
   Created/Updated/Last seen enough to force the timestamp onto two
   lines, all while the table's own outer box still reported 100% of a
   now-wide .admin-page. table-layout: fixed switches column sizing to
   the explicit percentages on the <col> elements in the HTML (see
   admin_users_page in server.py) instead of guessing from content. */
.admin-table-scroll {
  width: 100%;
  overflow-x: auto;
}

.admin-users-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.admin-users-table th,
.admin-users-table td {
  border: 1px solid #d9dde2;
  padding: 6px 8px;
  font-size: 13px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-users-table col.col-email { width: 18%; }
.admin-users-table col.col-agency { width: 8%; }
.admin-users-table col.col-role { width: 7%; }
.admin-users-table col.col-test-mode { width: 7%; }
.admin-users-table col.col-active { width: 6%; }
.admin-users-table col.col-created,
.admin-users-table col.col-updated,
.admin-users-table col.col-last-seen { width: 12%; }
.admin-users-table col.col-actions { width: 18%; }

.admin-users-table td.col-created,
.admin-users-table td.col-updated,
.admin-users-table td.col-last-seen {
  white-space: nowrap;
}

.admin-users-table td.col-actions {
  white-space: normal;
}

.admin-inline-form {
  display: inline-block;
  margin-right: 6px;
}

/* Phase J3B: tester feedback controls (visible only when the signed-in
   session has test_mode=true -- see renderFeedbackControls in index.html) */

.feedback-panel {
  margin-top: 28px;
  padding: 18px 22px;
  background: #f7f8fa;
  border: 1px solid #d9dde2;
  border-radius: 8px;
}

.feedback-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.feedback-existing {
  margin: 0 0 12px;
  font-size: 14px;
  color: #334e68;
}

.feedback-ratings {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.feedback-rating-button {
  padding: 8px 14px;
  border: 1px solid #bfc6ce;
  border-radius: 6px;
  background: #ffffff;
  color: #20252b;
  font: inherit;
  cursor: pointer;
}

.feedback-rating-button:hover {
  background: #eef1f4;
}

.feedback-rating-button.is-selected {
  background: #34495e;
  border-color: #34495e;
  color: #ffffff;
}

.feedback-panel label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

.feedback-panel textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #bfc6ce;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
}

.feedback-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

#feedback-submit {
  padding: 10px 18px;
  border: 1px solid #34495e;
  border-radius: 6px;
  background: #34495e;
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

#feedback-submit:disabled {
  background: #9aa5b1;
  border-color: #9aa5b1;
  cursor: not-allowed;
}

.feedback-status {
  font-size: 13px;
  color: #205c2e;
}

/* Phase J3B: admin feedback review page */

.admin-nav {
  margin: -6px 0 16px;
  font-size: 14px;
}

.admin-nav a {
  color: #334e68;
}

.admin-feedback-subtitle {
  margin: 0 0 16px;
  font-size: 13px;
  color: #69737d;
}

.admin-feedback-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.admin-feedback-table th,
.admin-feedback-table td {
  border: 1px solid #d9dde2;
  padding: 6px 8px;
  font-size: 13px;
  text-align: left;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-feedback-table col.col-created { width: 10%; }
.admin-feedback-table col.col-tester { width: 12%; }
.admin-feedback-table col.col-rating { width: 7%; }
.admin-feedback-table col.col-comment { width: 13%; }
.admin-feedback-table col.col-status { width: 7%; }
.admin-feedback-table col.col-mono { width: 10%; }
.admin-feedback-table col.col-question { width: 13%; }
.admin-feedback-table col.col-guidance { width: 13%; }
.admin-feedback-table col.col-amount { width: 6%; }
.admin-feedback-table col.col-category { width: 5%; }
.admin-feedback-table col.col-method { width: 4%; }

.admin-feedback-table td.col-created {
  white-space: nowrap;
}

.admin-feedback-table td.col-mono {
  font-family: monospace;
  font-size: 11px;
  word-break: break-all;
  white-space: normal;
}

.admin-feedback-table td.col-comment,
.admin-feedback-table td.col-question,
.admin-feedback-table td.col-guidance {
  white-space: normal;
}

.feedback-status-latest {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e3f3e8;
  color: #205c2e;
  font-weight: 600;
  font-size: 12px;
}

.feedback-status-superseded {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: #eceef1;
  color: #566270;
  font-size: 12px;
}

.onboarding-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.onboarding-table th,
.onboarding-table td {
  border: 1px solid #d9dde2;
  padding: 6px 8px;
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}

.onboarding-table th:first-child,
.onboarding-table td:first-child {
  width: 20%;
}

.onboarding-table th:nth-child(2),
.onboarding-table td:nth-child(2) {
  width: 14%;
}

.onboarding-status-ready {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e3f3e8;
  color: #205c2e;
  font-weight: 600;
  font-size: 12px;
}

.onboarding-status-attention {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: #fdf0d5;
  color: #7a4b00;
  font-weight: 600;
  font-size: 12px;
}

.onboarding-status-not-configured {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: #eceef1;
  color: #566270;
  font-weight: 600;
  font-size: 12px;
}
