/* Mitigateway Weekly Pulse
   Values here are lifted from the design prototype; keep them in sync with it.
   Palette: bg #F8FAFC / card #FFFFFF / border #E2E8F0 / divider #F1F5F9
            ink #0F172A / body #334155 / secondary #64748B / muted #94A3B8
            primary #0099FF / accent #ED7D31 (negatives and low scores only) */

*,
*::before,
*::after { box-sizing: border-box; }

html,
body { margin: 0; padding: 0; }

/* The pages toggle views with the `hidden` attribute, and several of those
   elements set `display` themselves -- an author `display` beats the browser's
   default rule for [hidden], so it has to be forced here. */
[hidden] { display: none !important; }

body {
  font-family: Roboto, Helvetica, Arial, sans-serif;
  font-weight: 400;
  color: #334155;
  background: #F8FAFC;
  -webkit-font-smoothing: antialiased;
}

a { color: #0099FF; text-decoration: none; }
a:hover { color: #0F172A; text-decoration: underline; }

button { font-family: Roboto, Helvetica, Arial, sans-serif; }

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- header ------------------------------------------------------------- */

.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 32px;
  border-bottom: 1px solid #E2E8F0;
  background: rgba(255, 255, 255, 0.8);
}

.hdr-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.wordmark {
  font-family: 'Roboto Slab', Georgia, serif;
  font-weight: 800;
  font-size: 22px;
  color: #0F172A;
  letter-spacing: -0.5px;
}

.badge-outline {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid #CBD5E1;
  color: #64748B;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.seg {
  display: flex;
  gap: 4px;
  background: #F1F5F9;
  padding: 4px;
  border-radius: 8px;
}

.seg > a {
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: #64748B;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.seg > a:hover { color: #0F172A; text-decoration: none; }

.seg > a[aria-current='page'] {
  background: #0F172A;
  color: #fff;
}

/* --- page frames -------------------------------------------------------- */

.col {
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
}

.col-survey { max-width: 720px; gap: 20px; }
.col-dash { max-width: 1080px; gap: 24px; }

.footer-rule {
  margin-top: auto;
  height: 4px;
  background: #0099FF;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #64748B;
}

.page-title {
  font-family: 'Roboto Slab', Georgia, serif;
  font-weight: 700;
  font-size: 34px;
  line-height: 1.15;
  color: #0F172A;
  letter-spacing: -0.5px;
  margin: 0;
}

.lede {
  font-size: 17px;
  line-height: 1.65;
  color: #64748B;
  text-wrap: pretty;
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 8px;
}

.card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sec-title {
  font-family: 'Roboto Slab', Georgia, serif;
  font-weight: 700;
  font-size: 19px;
  color: #0F172A;
}

.sec-note { font-size: 13px; color: #64748B; line-height: 1.5; }

.micro {
  display: inline-flex;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #94A3B8;
}

.empty { font-size: 14px; color: #94A3B8; font-style: italic; }

/* --- survey questions --------------------------------------------------- */

.q-card { gap: 18px; }
.q-card-tight { gap: 16px; }
.q-card-text { gap: 14px; }

.q-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.q-num {
  min-width: 28px;
  font-family: 'Roboto Slab', Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  color: #94A3B8;
}

.q-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.q-text {
  font-size: 18px;
  font-weight: 500;
  color: #0F172A;
  line-height: 1.45;
  text-wrap: pretty;
}

.helper { font-size: 13px; color: #64748B; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover { border-color: #0099FF; color: #0099FF; }

.chip[aria-pressed='true'],
.chip[aria-pressed='true']:hover {
  background: #0099FF;
  border-color: #0099FF;
  color: #fff;
}

.chip-sm { padding: 6px 14px; font-size: 12.5px; }

.q0-personal {
  border-top: 1px solid #F1F5F9;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.q0-personal-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.personal-placeholder {
  font-size: 16px;
  color: #94A3B8;
  font-style: italic;
}

.scale {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.scale-end {
  font-size: 12px;
  color: #94A3B8;
  width: 72px;
}

.scale-end-lo { text-align: right; }

.scale-btns {
  display: flex;
  gap: 10px;
}

.sbtn {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #64748B;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.sbtn:hover { border-color: #0099FF; color: #0099FF; }

.sbtn[aria-pressed='true'],
.sbtn[aria-pressed='true']:hover {
  background: #0099FF;
  border-color: #0099FF;
  color: #fff;
}

textarea {
  width: 100%;
  min-height: 96px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 14px;
  font-family: Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: #334155;
  resize: vertical;
  outline-color: #0099FF;
}

.submit-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

.submit {
  padding: 14px 36px;
  border-radius: 6px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  background: #0099FF;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.submit:disabled {
  background: #F1F5F9;
  color: #94A3B8;
  cursor: not-allowed;
}

.submit-note { font-size: 12px; color: #94A3B8; text-align: center; }
.submit-error { font-size: 13px; color: #ED7D31; text-align: center; }

.btn-secondary {
  padding: 11px 22px;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #334155;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.btn-secondary:hover { border-color: #0099FF; color: #0099FF; text-decoration: none; }

/* --- confirmation ------------------------------------------------------- */

.done {
  max-width: 640px;
  margin: 80px auto;
  padding: 0 24px;
  text-align: center;
}

.done-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid #0099FF;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 30px;
  color: #0099FF;
}

.done-title {
  font-family: 'Roboto Slab', Georgia, serif;
  font-weight: 800;
  font-size: 40px;
  color: #0F172A;
  letter-spacing: -1px;
  margin: 0 0 12px;
}

.done-sub { font-size: 17px; color: #64748B; line-height: 1.6; }
.done > .btn-secondary { margin-top: 28px; }

/* --- dashboard ---------------------------------------------------------- */

.dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.dash-head-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash-head-text .lede { font-size: 16px; line-height: 1.5; }

.dash-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #64748B;
}

.stat-num {
  font-family: 'Roboto Slab', Georgia, serif;
  font-weight: 700;
  font-size: 40px;
  color: #0F172A;
}

.stat-num > span { font-size: 22px; }
.stat-num > .of-team { color: #94A3B8; }

.avg-rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.avg-row {
  display: grid;
  grid-template-columns: 44px 1fr 220px 48px;
  gap: 14px;
  align-items: center;
}

.avg-label {
  font-family: 'Roboto Slab', Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  color: #94A3B8;
}

.avg-text { font-size: 14px; color: #334155; line-height: 1.4; }

.bar {
  height: 10px;
  border-radius: 999px;
  background: #F1F5F9;
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #0099FF;
}

.avg-num {
  font-family: 'Roboto Slab', Georgia, serif;
  font-weight: 700;
  font-size: 18px;
  color: #0F172A;
  text-align: right;
}

.trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.trend-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.trend-svg {
  width: 100%;
  height: auto;
  display: block;
}

.two-up {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  align-items: start;
}

.quotes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quote {
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.55;
  color: #334155;
  background: #F8FAFC;
}

.rot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rot-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rot-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: baseline;
  border-bottom: 1px solid #F1F5F9;
  padding-bottom: 10px;
}

.rot-name { font-size: 14px; font-weight: 700; color: #0F172A; }
.rot-question { font-size: 13.5px; color: #334155; line-height: 1.5; }

.table-scroll { overflow-x: auto; }

.grid-table {
  min-width: 560px;
  display: flex;
  flex-direction: column;
}

.grid-table > div {
  display: grid;
  grid-template-columns: 110px repeat(var(--score-cols, 6), 1fr);
  gap: 8px;
  padding: 10px 12px;
}

.grid-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #64748B;
  border-bottom: 2px solid #E2E8F0;
}

.grid-head > span + span { text-align: center; }

.grid-row {
  font-size: 14px;
  color: #334155;
  border-bottom: 1px solid #F1F5F9;
  align-items: center;
}

.grid-row > .row-label { color: #94A3B8; font-size: 13px; }

.cell {
  text-align: center;
  font-weight: 600;
  padding: 4px 0;
}

.cell-low { color: #ED7D31; }
.cell-none { color: #CBD5E1; }

/* --- login -------------------------------------------------------------- */

.login {
  max-width: 420px;
  width: 100%;
  margin: 80px auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login .card { gap: 16px; }

.login input[type='password'] {
  width: 100%;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 12px 14px;
  font-family: Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: #334155;
  outline-color: #0099FF;
}

.login .submit { padding: 12px 24px; }

/* --- narrow screens ----------------------------------------------------- */

@media (max-width: 760px) {
  .hdr { padding: 16px 20px; }
  .col { padding: 32px 18px 64px; }
  .page-title { font-size: 28px; }
  .done-title { font-size: 32px; }
  .card { padding: 20px; }
  .scale-end { width: auto; }
  .scale-end-lo { text-align: left; }
  .scale { gap: 8px; }
  .sbtn { width: 44px; height: 44px; }

  .avg-row { grid-template-columns: 40px 1fr 44px; }
  .avg-row > .bar { grid-column: 1 / -1; }

  .rot-row { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 400px) {
  .scale-btns { gap: 6px; }
  .sbtn { width: 40px; height: 40px; font-size: 14px; }
}

/* ===================================================================
   Accounts, admin portal, forms (added for the public/login rebuild)
   =================================================================== */

.hdr-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.logout-form { margin: 0; }

.linkish {
  border: none;
  background: none;
  padding: 0;
  font-family: Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #64748B;
  cursor: pointer;
}
.linkish:hover { color: #0F172A; text-decoration: underline; }
.linkish.danger { color: #ED7D31; }
.linkish.danger:hover { color: #c85a12; }

/* --- narrow single-column pages (login, change password) --- */

.narrow {
  max-width: 460px;
  width: 100%;
  margin: 0 auto;
  padding: 56px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-card { gap: 18px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #64748B;
}

.field input,
.field select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 11px 13px;
  font-family: Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: #334155;
  background: #fff;
  outline-color: #0099FF;
}
.field input:focus,
.field select:focus { border-color: #0099FF; }

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: #FDF0E7;
  border: 1px solid #F4C9A8;
  color: #c85a12;
  font-size: 13.5px;
}

.signed-as { font-size: 14px; color: #64748B; }
.signed-as strong { color: #0F172A; }

/* --- flash banners on the admin page --- */

.flash {
  border-radius: 8px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.5;
}
.flash-ok { background: #EAF6FF; border: 1px solid #B6E0FE; color: #0F172A; }
.flash-error { background: #FDF0E7; border: 1px solid #F4C9A8; color: #c85a12; }
.flash-title { font-weight: 600; margin-bottom: 8px; }
.flash-note { color: #64748B; font-size: 13px; margin-top: 8px; }

.temp-pw {
  font-family: 'Roboto Slab', Georgia, serif;
}
.temp-pw code {
  display: inline-block;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #0F172A;
  background: #fff;
  border: 1px solid #B6E0FE;
  border-radius: 6px;
  padding: 8px 14px;
}

/* --- participation --- */

.part-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.ptags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.ptag {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #E2E8F0;
}
.ptag-done { background: #EAF6FF; border-color: #B6E0FE; color: #0369a1; }
.ptag-wait { background: #fff; color: #64748B; }
.muted-inline { color: #94A3B8; font-size: 13px; font-style: italic; }

/* --- create-login form (inline row) --- */

.row-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 14px;
  align-items: end;
}
.submit-inline { padding: 11px 20px; height: fit-content; }

/* --- users table --- */

.users-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 14px;
}
.users-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #64748B;
  border-bottom: 2px solid #E2E8F0;
  padding: 10px 12px;
}
.users-table td {
  padding: 12px;
  border-bottom: 1px solid #F1F5F9;
  color: #334155;
  vertical-align: middle;
}
.users-table code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  color: #0F172A;
}
.actions-col { white-space: nowrap; }
.inline-form { display: inline; margin: 0 8px 0 0; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.tag-ok { background: #EAF6FF; color: #0369a1; }
.tag-off { background: #F1F5F9; color: #64748B; }
.tag-warn { background: #FDF0E7; color: #c85a12; }
.tag-info { background: #FEF9E7; color: #a16207; }

@media (max-width: 760px) {
  .part-grid { grid-template-columns: 1fr; }
  .row-form { grid-template-columns: 1fr; }
}

/* --- questions management (admin) --- */

.q-admin-list { display: flex; flex-direction: column; gap: 8px; }

.q-admin-item {
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  background: #fff;
}
.q-admin-item[open] { background: #FBFDFF; }

.q-admin-item > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}
.q-admin-item > summary::-webkit-details-marker { display: none; }
.q-admin-item > summary::before {
  content: "▸";
  color: #94A3B8;
  font-size: 12px;
}
.q-admin-item[open] > summary::before { content: "▾"; }

.q-admin-code {
  font-family: 'Roboto Slab', Georgia, serif;
  font-weight: 700;
  font-size: 13px;
  color: #94A3B8;
  min-width: 30px;
}
.q-admin-text { flex: 1; font-size: 14px; color: #0F172A; line-height: 1.4; }

.q-admin-edit {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 14px 14px 14px;
  border-top: 1px solid #F1F5F9;
}
.q-admin-add {
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px dashed #E2E8F0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.q-admin-add-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.q-admin-item .inline-form { padding: 0 14px 14px 14px; }

@media (max-width: 760px) {
  .q-admin-add-row { grid-template-columns: 1fr; }
}
