:root {
  --ink: #17202a;
  --muted: #657282;
  --line: #dfe6ee;
  --soft: #f5f7fa;
  --brand: #008b8b;
  --brand-dark: #006b6d;
  --accent: #f3b33f;
  --danger: #b3261e;
  --white: #fff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--soft);
  letter-spacing: 0;
}
a { color: var(--brand-dark); text-decoration: none; font-weight: 700; }
button, input, textarea, select { font: inherit; }
button, .as-link {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 800;
}
.primary { background: var(--brand); color: white; }
.primary:hover { background: var(--brand-dark); }
.ghost { background: white; color: var(--brand-dark); border: 1px solid var(--line); }
.hidden { display: none !important; }
.brand-mark, .logo-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--white);
  font-weight: 900;
}

.public-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(0, 139, 139, .13), rgba(243, 179, 63, .18)),
    var(--soft);
  padding: 22px;
}
.public-top, .briefing-form {
  width: min(860px, 100%);
  margin: 0 auto;
}
.public-top {
  padding: 22px 0 14px;
}
.public-top h1 {
  margin: 22px 0 8px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1;
}
.public-top p {
  max-width: 660px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}
.progress {
  height: 10px;
  background: rgba(255,255,255,.75);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 22px;
}
.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width .25s ease;
}
.briefing-form {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(23,32,42,.08);
  overflow: hidden;
}
.form-step { display: none; padding: 26px; }
.form-step.active { display: block; }
.section-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 20px;
}
.section-heading span {
  color: var(--brand-dark);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
}
.section-heading h2 {
  margin: 7px 0;
  font-size: 28px;
}
.section-heading p, .help {
  color: var(--muted);
  line-height: 1.45;
}
.field {
  padding: 16px 0;
  border-bottom: 1px solid #eef2f6;
}
.field-title {
  display: block;
  font-weight: 850;
  margin-bottom: 8px;
}
.field-title strong { color: var(--danger); }
input, textarea, select {
  width: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  min-height: 46px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 112px; resize: vertical; }
.choices, .rating {
  display: grid;
  gap: 10px;
}
.choices label, .rating label, .inline-checks label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}
.choices input, .rating input, .inline-checks input { width: auto; min-height: auto; margin-top: 3px; }
.step-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 22px;
}
.step-actions .primary { margin-left: auto; }

.thanks-page, .login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, rgba(0, 139, 139, .15), rgba(243, 179, 63, .18)), var(--soft);
}
.thanks-page section, .login-card {
  width: min(520px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 18px 45px rgba(23,32,42,.09);
}
.thanks-page h1, .login-card h1 { margin: 22px 0 8px; font-size: 34px; }
.login-card label { display: grid; gap: 8px; margin: 14px 0; font-weight: 800; }
.alert {
  background: #fff1f0;
  border: 1px solid #ffd2ce;
  color: var(--danger);
  padding: 12px;
  border-radius: 8px;
  font-weight: 800;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #111820;
  color: white;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.sidebar .brand-mark { background: var(--brand); }
.sidebar nav { display: grid; gap: 8px; }
.sidebar a {
  color: white;
  padding: 12px;
  border-radius: 8px;
  font-weight: 800;
}
.sidebar a.active, .sidebar a:hover { background: rgba(255,255,255,.12); }
.logout { margin-top: auto; opacity: .8; }
.admin-main {
  padding: 28px;
  min-width: 0;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.admin-header h1 { margin: 0 0 6px; font-size: 32px; }
.admin-header p { margin: 0; color: var(--muted); }
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.metrics div, .editor-panel, .questions-list, .summary-grid, .status-form, .answer-section, .team-notes, .print-header {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.metrics div { padding: 18px; }
.metrics strong { display: block; font-size: 28px; }
.metrics span { color: var(--muted); font-weight: 700; }
.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px 180px 180px auto;
  gap: 10px;
  margin-bottom: 16px;
}
.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}
th, td {
  padding: 14px;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-size: 13px; text-transform: uppercase; }
td small { display: block; color: var(--muted); margin-top: 4px; }
.status {
  display: inline-flex;
  border: 1px solid #d3eadf;
  background: #eefaf4;
  color: #146c43;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 850;
  white-space: nowrap;
}
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.actions button {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 800;
}

.questions-grid {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 18px;
  align-items: start;
}
.questions-grid .admin-header { grid-column: 1 / -1; }
.editor-panel, .questions-list { padding: 20px; }
.editor-panel form { display: grid; gap: 12px; }
.editor-panel label { display: grid; gap: 7px; font-weight: 800; }
.inline-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.section-mini {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.question-section { margin-bottom: 24px; }
.question-section h2 { margin: 0 0 10px; }
.question-section article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
  margin-bottom: 8px;
}
.question-section article.inactive { opacity: .55; }
.question-section small { display: block; color: var(--muted); margin-top: 4px; }

.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.print-header { padding: 22px; margin-bottom: 14px; }
.print-header h1 { margin: 12px 0 0; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 14px;
}
.summary-grid div {
  padding: 14px;
  background: white;
}
.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 850;
}
.summary-grid strong { display: block; margin-top: 4px; }
.status-form {
  padding: 16px;
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}
.status-form label { display: grid; gap: 7px; font-weight: 800; }
.answer-section, .team-notes {
  padding: 20px;
  margin-bottom: 14px;
}
.answer-section h2, .team-notes h2 { margin-top: 0; }
.answer-row {
  padding: 12px 0;
  border-top: 1px solid #edf1f5;
}
.answer-row p { margin: 6px 0 0; color: #263442; line-height: 1.45; }

@media (max-width: 900px) {
  .admin-shell { display: block; }
  .sidebar {
    position: static;
    height: auto;
    border-radius: 0;
  }
  .sidebar nav { grid-template-columns: 1fr 1fr; }
  .admin-main, .public-page { padding: 16px; }
  .filters, .metrics, .questions-grid, .summary-grid, .status-form {
    grid-template-columns: 1fr;
  }
  .admin-header, .question-section article {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .public-page { padding: 12px; }
  .form-step { padding: 18px; }
  .public-top h1 { font-size: 36px; }
  .step-actions { flex-direction: column; }
  .step-actions .primary { margin-left: 0; }
  .inline-checks { grid-template-columns: 1fr; }
  .sidebar nav { grid-template-columns: 1fr; }
}

@media print {
  body, .admin-shell { display: block; background: white; }
  .sidebar, .no-print { display: none !important; }
  .admin-main { padding: 0; }
  .print-header, .summary-grid, .answer-section, .team-notes {
    border-color: #999;
    box-shadow: none;
    page-break-inside: avoid;
  }
  a { color: #000; }
}
