:root {
  --bg: #f6f4ef;
  --card: #f6f4ef;
  --text: #0f4d4a;
  --muted: #7fa7a1;
  --primary: #0f4d4a;
  --primary-dark: #1d4ed8;
  --border: #dbe3f0;
  --error: #b91c1c;
  --success: #166534;
  --secondary: #e5e7eb;
  --secondary-text: #1f2937;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
}


.page-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.topbar h1 {
  margin: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  height: 100px;
  width: auto;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link {
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  background: white;
}

.nav-link.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.card,
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.card {
  padding: 24px;
}

.panel {
  padding: 18px;
  margin-top: 18px;
}

h2,
h3 {
  margin-top: 0;
}

form {
  display: grid;
  gap: 12px;
}

label {
  font-weight: 600;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: var(--secondary);
  color: var(--secondary-text);
}

button.danger {
  background: #b91c1c;
}

button:hover {
  opacity: 0.95;
}

.status {
  margin-top: 20px;
  min-height: 24px;
  color: var(--muted);
}

.status.error {
  color: var(--error);
}

.list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.campaign-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.summary-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.portal-details {
  display: grid;
  gap: 12px;
  margin: 8px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.portal-details[hidden] {
  display: none;
}

.portal-details legend {
  padding: 0 6px;
  font-weight: 600;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--primary);
  font-weight: 600;
}

.demo-inline {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
}

.success-panel {
  border-color: rgba(22, 101, 52, 0.4);
  background: #f0fdf4;
}

.field-test-details {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.field-test-details p {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.staff-shell {
  max-width: 1180px;
}

.staff-topbar {
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.staff-topbar h1,
.staff-welcome h2 {
  margin: 0;
}

.header-user {
  color: var(--muted);
}

.menu-toggle,
.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
}

.menu-toggle {
  gap: 4px;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
}

.icon-button {
  background: transparent;
  color: var(--text);
  font-size: 1.5rem;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(15, 23, 42, 0.35);
}

.staff-menu {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 11;
  width: min(86vw, 320px);
  height: 100vh;
  padding: 24px;
  background: var(--card);
  box-shadow: -12px 0 30px rgba(15, 23, 42, 0.15);
  transform: translateX(100%);
  transition: transform 180ms ease;
}

.staff-menu.open {
  transform: translateX(0);
}

.menu-header,
.panel-heading,
.panel-heading-actions,
.panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.menu-items {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.menu-items button {
  width: 100%;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
}

.menu-items button:hover {
  background: var(--secondary);
}

.applet-question {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 0 16px;
}

.applet-question legend {
  font-weight: 600;
  padding: 0 4px;
}

.questionnaire-viewer {
  display: grid;
  grid-template-rows: minmax(150px, 1fr) minmax(180px, auto) auto;
  gap: 24px;
  min-height: 480px;
  margin-top: 18px;
}

.question-section,
.answers-section,
.timer-section {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.question-section {
  display: grid;
  align-content: center;
}

.question-section h3 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  line-height: 1.35;
}

.answers-section {
  display: grid;
  align-content: center;
  gap: 12px;
}

.answer-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  color: var(--text);
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
}

.answer-option:hover,
.answer-option:focus-visible {
  background: #e8f1ef;
  border-color: var(--primary);
  opacity: 1;
}

.answer-key {
  display: inline-grid;
  flex: 0 0 32px;
  place-items: center;
  width: 32px;
  height: 32px;
  color: white;
  background: var(--primary);
  border-radius: 50%;
  font-weight: 700;
}

.timer-section {
  display: grid;
  gap: 8px;
}

.timer-label-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.timer-track {
  height: 14px;
  overflow: hidden;
  background: #e5e7eb;
  border-radius: 999px;
}

.timer-bar {
  width: 100%;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
  transition: width 100ms linear, background-color 180ms ease;
}

.timer-bar[style*="width: 2%"],
.timer-bar[style*="width: 1%"],
.timer-bar[style*="width: 0%"] {
  background: var(--error);
}

.applet-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  padding: 6px 0;
}

.applet-option input {
  width: auto;
}

.score-chart {
  display: grid;
  place-items: center;
  width: min(100%, 720px);
  min-height: 440px;
  margin: 0 auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.polar-chart {
  display: block;
  width: 100%;
  max-width: 820px;
  height: auto;
  overflow: visible;
}

.polar-ring {
  fill: none;
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 2 5;
}

.polar-core {
  fill: var(--card);
  stroke: var(--border);
  stroke-width: 2;
}

.polar-bar {
  stroke: var(--card);
  stroke-width: 1;
  transition: opacity 160ms ease;
}

.polar-bar:hover {
  opacity: 0.72;
}

.polar-score {
  fill: var(--primary);
}

.polar-confidence {
  fill: #d97706;
}

.polar-label {
  fill: var(--text);
  font-size: 10px;
  font-weight: 700;
}

.polar-core-label {
  fill: var(--primary);
  font-size: 32px;
  font-weight: 700;
}

.polar-core-caption {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dimension-chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.dimension-chart-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.dimension-chart-panel h4 {
  margin: 0;
  text-align: center;
}

.dimension-chart {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.dimension-svg {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  overflow: visible;
}

.dimension-slice-background {
  opacity: 0.2;
}

.dimension-slice {
  stroke: var(--card);
  stroke-width: 2;
}

.dimension-label {
  fill: var(--text);
  font-size: 9px;
  font-weight: 700;
}

.dimension-core {
  fill: var(--card);
  stroke: var(--border);
  stroke-width: 1;
}

.dimension-metric-list {
  display: grid;
  width: 100%;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.dimension-metric-list strong {
  color: var(--text);
}

.dimension-chart-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.chart-legend {
  display: flex;
  gap: 18px;
  margin: 14px 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.legend-score::before,
.legend-confidence::before {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 3px;
  content: "";
}

.legend-score::before {
  background: var(--primary);
}

.legend-confidence::before {
  background: #d97706;
}

.confidence-details {
  margin-top: 18px;
  border-top: 1px solid var(--border);
}

.confidence-details summary {
  padding: 12px 0;
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
}

.action-callout {
  margin-top: 20px;
  padding: 16px 18px;
  border-left: 4px solid #d97706;
  background: #fff7ed;
}

.suggested-action {
  margin: 0;
  line-height: 1.55;
  white-space: pre-line;
}

.consequence-assessments {
  margin-top: 20px;
}

.consequence-assessment {
  padding: 14px 0;
  border-top: 1px solid rgba(15, 77, 74, 0.18);
}

.consequence-assessment h4,
.consequence-assessment p {
  margin: 0 0 8px;
  line-height: 1.5;
}

.consequence-assessment h4 {
  color: var(--primary);
}

.overall-section {
  padding: 34px 28px;
  color: white;
  text-align: center;
  background: linear-gradient(135deg, var(--primary), #176b67);
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(15, 77, 74, 0.22);
}

.overall-section h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.overall-section .eyebrow,
.overall-section p {
  color: rgba(255, 255, 255, 0.78);
}

.overall-score-value {
  display: block;
  margin: 4px 0;
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  line-height: 1;
}

.staff-main {
  display: grid;
  gap: 24px;
}

.staff-welcome {
  padding: 12px 4px;
}

.staff-view[hidden] {
  display: none;
}

.dashboard-panel {
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.account-section {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

dl {
  margin: 0;
}

.account-field {
  display: grid;
  grid-template-columns: minmax(100px, 0.7fr) minmax(0, 1.3fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.account-field:last-child {
  border-bottom: 0;
}

dt {
  color: var(--muted);
  font-weight: 600;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.launch-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.launch-item {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.launch-item h4,
.launch-item p {
  margin-top: 0;
}

.launch-item h4 {
  margin-bottom: 6px;
}

.launch-meta {
  min-width: 240px;
}

.results-narrative {
  max-width: 850px;
  line-height: 1.6;
  white-space: pre-line;
}

.evidence-sources {
  margin-top: 18px;
}

.evidence-sources ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.confidence-table {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  overflow-x: auto;
}

.confidence-row {
  display: grid;
  grid-template-columns: 72px minmax(130px, 1fr) minmax(150px, 1fr) 80px 70px;
  gap: 10px;
  min-width: 560px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.confidence-heading {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel-actions {
  justify-content: flex-start;
  margin-top: 24px;
}

.error-text {
  color: var(--error);
}

@media (max-width: 700px) {
  .page-shell {
    padding: 20px 14px;
  }

  .topbar {
    margin-bottom: 18px;
  }

  .header-user {
    display: none;
  }

  .dashboard-panel {
    padding: 18px;
  }

  .account-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .dimension-chart-grid {
    grid-template-columns: 1fr;
  }

  .account-field {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .launch-item {
    display: grid;
    gap: 14px;
  }

  .launch-meta {
    min-width: 0;
  }

  .panel-heading-actions,
  .panel-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-heading-actions button,
  .panel-actions button {
    width: 100%;
  }
}
