:root {
  --ink: #1f2933;
  --muted: #667085;
  --line: #c9d3dc;
  --soft-line: #e4e9ee;
  --paper: #ffffff;
  --background: #f4f7f8;
  --panel: #ffffff;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --gold: #9a6b13;
  --danger: #b42318;
  --print-blue: #064b76;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--background);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--teal);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 16px;
}

button:hover {
  background: var(--teal-dark);
}

button:disabled {
  background: #b8c3c9;
  cursor: not-allowed;
}

.secondary-button {
  background: #eef4f4;
  color: var(--teal-dark);
  border: 1px solid #bfd5d2;
}

.secondary-button:hover {
  background: #dfeceb;
}

.app-shell {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.login-page,
.role-page {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel,
.role-panel {
  background: #ffffff;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(31, 41, 51, 0.12);
  display: grid;
  gap: 12px;
  max-width: 430px;
  padding: 28px;
  width: 100%;
}

.role-panel {
  max-width: 760px;
}

.login-panel h1,
.role-panel h1 {
  font-size: 25px;
  line-height: 1.2;
  margin: 0 0 8px;
}

.login-panel label {
  font-weight: 800;
}

.error-message {
  color: var(--danger);
  font-size: 14px;
  min-height: 20px;
  margin: 0;
}

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

.role-card {
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid var(--soft-line);
  color: var(--ink);
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 18px;
  text-align: left;
}

.role-card:hover {
  background: #f3faf9;
  border-color: #8fc6bf;
  color: var(--ink);
}

.role-card strong {
  color: var(--teal-dark);
  font-size: 20px;
}

.role-card span {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.4;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--soft-line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 20px 28px;
}

.topbar h1,
.preview-toolbar h2 {
  margin: 3px 0 0;
}

.role-badge {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  margin: 4px 0 0;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.eyebrow {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.workspace {
  display: grid;
  gap: 18px;
  grid-template-columns: 260px minmax(340px, 500px) minmax(520px, 1fr);
  padding: 18px;
}

.officer-mode .workspace {
  grid-template-columns: 220px minmax(260px, 340px) minmax(320px, 440px) minmax(520px, 1fr);
}

.section-rail,
.interview-panel,
.officer-review-panel,
.preview-panel {
  background: var(--panel);
  border: 1px solid var(--soft-line);
  border-radius: 8px;
}

.section-rail,
.officer-review-panel {
  align-self: start;
  padding: 16px;
  position: sticky;
  top: 16px;
}

.officer-review-panel {
  display: grid;
  gap: 14px;
}

.officer-review-panel h2 {
  font-size: 20px;
  margin: 0;
}

.review-summary {
  border-bottom: 1px solid var(--soft-line);
  display: grid;
  gap: 12px;
  padding-bottom: 14px;
}

.review-stat {
  background: #eef7f5;
  border: 1px solid #bdd9d4;
  border-radius: 6px;
  display: grid;
  gap: 2px;
  padding: 12px;
}

.review-stat strong {
  color: var(--teal-dark);
  font-size: 30px;
}

.review-stat span,
.review-facts {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.review-facts p {
  line-height: 1.35;
  margin: 0 0 8px;
}

.suggestion-list {
  display: grid;
  gap: 10px;
}

.suggestion-card {
  border: 1px solid var(--soft-line);
  border-left: 4px solid var(--teal);
  border-radius: 6px;
  padding: 12px;
}

.suggestion-card.attention {
  border-left-color: var(--danger);
}

.suggestion-card strong {
  display: block;
  margin-bottom: 5px;
}

.suggestion-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
}

.ai-suggestion-box {
  background: #fbfdfd;
  border: 1px solid #cfe2df;
  border-radius: 6px;
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
}

.ai-suggestion-header,
.ai-recommendation {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.ai-suggestion-header strong,
.ai-recommendation strong {
  color: var(--teal-dark);
}

.ai-suggestion-content {
  color: var(--ink);
  display: grid;
  gap: 10px;
  line-height: 1.45;
}

.ai-suggestion-content p,
.ai-suggestion-content ul {
  margin: 0;
}

.ai-suggestion-content ul {
  padding-left: 18px;
}

.ai-recommendation span {
  background: #eef4f4;
  border: 1px solid #bfd5d2;
  border-radius: 999px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.ai-draft-text {
  background: #ffffff;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  padding: 10px;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.completion {
  border-bottom: 1px solid var(--soft-line);
  margin-bottom: 14px;
  padding-bottom: 14px;
}

.completion span {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
}

.completion-track {
  background: #e9eef1;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.completion-bar {
  background: var(--teal);
  height: 100%;
  transition: width 160ms ease;
  width: 0;
}

#sectionNav {
  display: grid;
  gap: 8px;
}

#sectionNav button {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--soft-line);
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  min-height: 44px;
  padding: 10px;
  text-align: left;
  width: 100%;
}

#sectionNav button.active {
  border-color: var(--teal);
  box-shadow: inset 3px 0 0 var(--teal);
}

#sectionNav small {
  color: var(--muted);
  font-weight: 700;
}

.interview-panel {
  align-self: start;
  padding: 22px;
  position: sticky;
  top: 16px;
}

.question-meta {
  color: var(--muted);
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

#questionTitle {
  font-size: 22px;
  line-height: 1.25;
  margin: 0 0 10px;
}

.hint {
  color: var(--muted);
  margin: 0 0 16px;
}

#questionControl {
  margin-top: 18px;
}

input[type="text"],
input[type="email"],
input[type="date"],
textarea {
  background: #ffffff;
  border: 1px solid #bcc8d1;
  border-radius: 6px;
  color: var(--ink);
  display: block;
  min-height: 44px;
  padding: 11px 12px;
  width: 100%;
}

textarea {
  line-height: 1.45;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.choice-group {
  border: 0;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.choice {
  align-items: flex-start;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  display: flex;
  gap: 10px;
  line-height: 1.35;
  padding: 12px;
}

.choice:has(input:checked) {
  background: #eff8f6;
  border-color: #8fc6bf;
}

.choice input {
  margin-top: 3px;
}

.owner-chat {
  display: grid;
  gap: 12px;
}

.chat-message {
  border-radius: 8px;
  display: grid;
  gap: 5px;
  line-height: 1.4;
  max-width: 92%;
  padding: 12px 14px;
}

.chat-message span {
  font-size: 12px;
  font-weight: 800;
}

.chat-message p {
  margin: 0;
}

.chat-message small {
  color: var(--muted);
  font-weight: 700;
}

.chat-message.bot {
  background: #eef7f5;
  border: 1px solid #c7dedb;
  color: var(--ink);
}

.chat-message.bot span {
  color: var(--teal-dark);
}

.chat-message.user {
  justify-self: end;
  background: #f7f4ed;
  border: 1px solid #dfd2b7;
}

.chat-message.user span {
  color: var(--gold);
}

.chat-message.current {
  box-shadow: inset 3px 0 0 var(--teal);
}

.chat-composer {
  background: #ffffff;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.button-row,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-row {
  border-top: 1px solid var(--soft-line);
  justify-content: space-between;
  margin-top: 22px;
  padding-top: 16px;
}

.preview-panel {
  min-width: 0;
  overflow: hidden;
}

.preview-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--soft-line);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  padding: 16px 18px;
}

.preview-toolbar h2 {
  font-size: 20px;
}

.action-row {
  justify-content: flex-end;
}

.pta-document {
  background: var(--paper);
  color: #000000;
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  line-height: 1.25;
  margin: 0 auto;
  max-width: 8.5in;
  min-height: 11in;
  padding: 0.7in 0.72in;
}

.pta-title-block {
  text-align: center;
}

.pta-title-block h1,
.pta-title-block h2,
.pta-section h2 {
  font-size: 14pt;
  margin: 10px 0;
  text-transform: uppercase;
}

.pta-title-block p {
  font-weight: 700;
  margin: 0 0 14px;
}

.pta-section {
  margin: 18px 0 0;
}

.pta-section h2 {
  text-align: center;
}

.pta-summary,
.pta-simple,
.pta-questions {
  border-collapse: collapse;
  margin: 0 0 14px;
  width: 100%;
}

.pta-summary th,
.pta-summary td,
.pta-simple th,
.pta-simple td,
.pta-questions th,
.pta-questions td {
  border: 1px solid #000000;
  padding: 6px 7px;
  vertical-align: top;
}

.pta-summary th,
.pta-simple th,
.pta-questions th {
  background: #f1f1f1;
  font-weight: 700;
  text-align: left;
}

.pta-summary th {
  width: 20%;
}

.pta-summary td {
  width: 30%;
}

.pta-simple th {
  width: 34%;
}

.pta-questions th {
  width: 43%;
}

.pta-document p {
  margin: 0 0 8px;
}

.pta-check-row {
  align-items: flex-start;
  display: flex;
  gap: 7px;
  margin: 0 0 7px;
}

.pta-check {
  border: 1.5px solid #000000;
  display: inline-flex;
  flex: 0 0 auto;
  height: 13px;
  justify-content: center;
  line-height: 11px;
  margin-top: 2px;
  width: 13px;
}

.pta-check.checked::after {
  content: "X";
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
  font-weight: 700;
}

.blank {
  color: #5f6368;
  font-style: italic;
}

.impact-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.impact-grid .pta-check-row {
  display: inline-flex;
  margin-right: 12px;
}

.centered-note {
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

@media (max-width: 1220px) {
  .workspace,
  .officer-mode .workspace {
    grid-template-columns: 220px minmax(320px, 1fr);
  }

  .preview-panel {
    grid-column: 1 / -1;
  }

  .interview-panel,
  .section-rail,
  .officer-review-panel {
    position: static;
  }
}

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

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

  .topbar-actions {
    justify-content: flex-start;
  }

  .workspace,
  .officer-mode .workspace {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .pta-document {
    font-size: 11pt;
    padding: 0.35in;
  }

  .pta-questions th,
  .pta-questions td,
  .pta-simple th,
  .pta-simple td {
    display: block;
    width: 100%;
  }
}

@page {
  margin: 0.55in;
}

@media print {
  body {
    background: #ffffff;
  }

  .no-print {
    display: none !important;
  }

  .workspace,
  .preview-panel {
    display: block;
    padding: 0;
    border: 0;
  }

  .app-shell,
  .pta-document {
    margin: 0;
    min-height: auto;
    max-width: none;
    padding: 0;
  }

  .pta-section {
    break-inside: avoid;
  }

  .pta-questions tr,
  .pta-simple tr,
  .pta-summary tr {
    break-inside: avoid;
  }
}
