/* Look modelled on Microsoft Forms / Fluent: grey canvas, ARA gradient banner, white question cards, Likert tables. */
:root {
  --brand: #0f6cbd;
  --brand-d: #115ea3;
  --brand-soft: #ebf3fc;
  --ara: #1b2a41;
  --ink: #242424;
  --sub: #616161;
  --line: #e0e0e0;
  --line-2: #d1d1d1;
  --bg: #f5f5f5;
  --card: #ffffff;
  --zebra: #fafafa;
  --ok: #107c10;
  --ok-soft: #dff6dd;
  --warn: #bc4b09;
  --warn-soft: #fdf3e7;
  --bad: #c50f1f;
  --bad-soft: #fdf3f4;
  --font: "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
  --shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 1px rgba(0, 0, 0, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
b, strong { font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
a:hover { color: var(--brand-d); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- banner ---------- */
.banner { height: 150px; background: linear-gradient(120deg, #1b2a41 0%, #24476b 55%, #0f6cbd 100%); color: #fff; position: relative; }
.banner .lg { position: absolute; left: 50%; transform: translateX(-50%); bottom: 22px; width: min(800px, calc(100% - 32px));
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.banner .logo { font-size: 26px; letter-spacing: .14em; font-weight: 600; }
.banner .label { font-size: 13px; opacity: .85; margin-left: 14px; }
.banner select { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .45); border-radius: 4px; padding: 5px 8px; }
.banner select option { color: var(--ink); }
.banner a { color: #fff; }
.banner.slim { height: 64px; }
.banner.slim .lg { bottom: 14px; width: min(1280px, calc(100% - 32px)); align-items: center; }
.banner .who { font-size: 13px; opacity: .85; margin-right: 14px; }

/* ---------- form column ---------- */
.form { width: min(800px, calc(100% - 32px)); margin: -14px auto 80px; position: relative; }
.wrap { width: min(1280px, calc(100% - 32px)); margin: 24px auto 80px; }
.card { background: var(--card); border-radius: 8px; box-shadow: var(--shadow); padding: 22px 28px; margin: 0 0 12px; }
.head { border-top: 8px solid var(--brand); padding-top: 22px; }
.head h1 { font-size: 28px; line-height: 1.25; margin-bottom: 6px; }
.head p { color: var(--sub); margin: 0 0 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 14px; font-size: 13px; color: var(--sub); }
.meta b { color: var(--ink); }
.notyours { font-size: 12px; color: var(--sub); margin-top: 6px; }
.muted { color: var(--sub); }
.small { font-size: 12px; }
.hidden { display: none !important; }

.pills { display: flex; gap: 10px; margin-top: 18px; }
.pill { flex: 1; display: block; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--zebra); color: var(--ink); text-decoration: none; }
.pill:hover { border-color: var(--line-2); background: #f0f0f0; color: var(--ink); }
.pill[aria-current="true"] { border-color: var(--brand); background: var(--brand-soft); }
.pill b { display: block; }
.pill small { color: var(--sub); }
.bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 4px; background: var(--brand); border-radius: 2px; transition: width .3s; }
.pill .tag { float: right; }

.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: var(--line); color: var(--sub); }
.tag.in_progress, .badge.in_progress { background: var(--brand-soft); color: var(--brand-d); }
.tag.submitted, .badge.submitted { background: var(--ok-soft); color: var(--ok); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--line); color: var(--sub); white-space: nowrap; }

/* section heading between cards */
.sec { margin: 22px 4px 8px; }
.sec small { color: var(--brand); font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
.sec h2 { font-size: 20px; margin-top: 2px; }
.sec p { color: var(--sub); margin: 4px 0 0; }

/* question cards */
.q { background: var(--card); border-radius: 8px; box-shadow: var(--shadow); padding: 20px 28px; margin: 0 0 10px; border-left: 4px solid transparent; transition: border-color .15s; }
.q:focus-within, .q.active { border-left-color: var(--brand); }
.q-text { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.q-text .n { color: var(--sub); font-weight: 400; margin-right: 6px; }
.q-text .req { color: var(--bad); }
.q-meta { font-size: 12px; color: var(--sub); margin-top: 10px; min-height: 1em; }
/* hint: "i" in a circle, bubble on hover / keyboard focus / tap */
.info { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; margin-left: 4px;
  padding: 0; border: 1px solid var(--brand); border-radius: 50%; background: #fff; color: var(--brand); font: italic 600 11px/1 Georgia, "Times New Roman", serif;
  vertical-align: 2px; cursor: help; }
.info:hover, .info:focus-visible { background: var(--brand); color: #fff; outline: none; }
.info .tip { display: none; position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%);
  width: max-content; max-width: 320px; padding: 10px 12px; border-radius: 6px; background: #fff; color: var(--ink);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2), 0 0 1px rgba(0, 0, 0, .2); font: 400 13px/1.45 var(--font); text-align: left; white-space: normal; cursor: default; }
.info .tip::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; }
.info:hover .tip, .info:focus .tip, .info:focus-within .tip { display: block; }
.lk .info .tip { left: -8px; transform: none; }
.lk .info .tip::after { left: 16px; }
.q.missing { border-left-color: var(--bad); }
.q.missing > .q-text::after, tr.missing .q-text::after { content: attr(data-err); display: block; color: var(--bad); font-size: 12px; font-weight: 400; margin-top: 4px; }

/* radios (buttons with aria-pressed drawn as Fluent radios) */
.choices { display: flex; flex-direction: column; gap: 2px; }
.choices button { display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: 0; border-radius: 4px; padding: 7px 8px; color: var(--ink); }
.choices button:hover:not(:disabled) { background: var(--bg); }
.rd { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--sub); flex: none; position: relative; background: #fff; display: inline-block; }
[aria-pressed="true"] > .rd { border-color: var(--brand); }
[aria-pressed="true"] > .rd::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--brand); }
button:disabled { cursor: default; }
button:disabled .rd { opacity: .7; }

/* Likert table */
.likert { padding: 18px 20px; }
.likert-title { font-size: 15px; font-weight: 600; margin: 0 8px 10px; }
table.lk { width: 100%; border-collapse: collapse; table-layout: fixed; }
.lk thead th { font-weight: 400; font-size: 12px; color: var(--sub); padding: 6px 4px 8px; text-align: center; vertical-align: bottom; width: 11%; line-height: 1.25; white-space: normal; overflow-wrap: normal; hyphens: auto; -webkit-hyphens: auto; }
.lk thead th:first-child { width: 34%; }
.lk tbody td { padding: 12px 4px; text-align: center; border-top: 1px solid var(--line); vertical-align: middle; }
.lk tbody td.stmt { text-align: left; padding: 12px 12px 12px 8px; }
.lk tbody tr:nth-child(even) td { background: var(--zebra); }
.lk tbody tr.missing td.stmt { box-shadow: inset 3px 0 0 var(--bad); }
.lk .q-text { font-size: 14px; font-weight: 400; margin: 0; }
.lk .q-meta { margin-top: 4px; min-height: 0; }
.lk .comment-toggle { margin-top: 4px; }
.lk td.opt button { background: none; border: 0; padding: 6px; border-radius: 50%; line-height: 0; }
.lk td.opt button:hover:not(:disabled) { background: var(--brand-soft); }
.lk td.opt button .lbl { display: none; }

/* inputs */
.q input[type=number], .q textarea, .field input, .field select, .field textarea, .counts input, .trow input, .trow select {
  width: 100%; border: 0; border-bottom: 1px solid #8a8a8a; border-radius: 4px 4px 0 0; background: var(--zebra); padding: 8px 10px; font-size: 14px; }
.q input:focus, .q textarea:focus, .field input:focus, .field select:focus, .counts input:focus, .trow input:focus, .trow select:focus {
  outline: none; border-bottom: 2px solid var(--brand); padding-bottom: 7px; background: #fff; }
.q input[type=number] { max-width: 220px; }
.q textarea { min-height: 80px; resize: vertical; }
.comment-toggle { background: none; border: 0; padding: 0; margin-top: 10px; font-size: 13px; color: var(--brand); font-weight: 600; }
.comment-toggle:hover { color: var(--brand-d); text-decoration: underline; }
.q .comment, .lk .comment { margin-top: 8px; min-height: 60px; }

.counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 16px; }
.counts label, .trow label { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; font-size: 12px; color: var(--sub); }
.trows { display: flex; flex-direction: column; gap: 8px; }
.trow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 12px; align-items: end; border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.trow > button { justify-self: start; margin: 0; }

/* buttons */
.btn { display: inline-block; background: var(--brand); color: #fff; border: 1px solid var(--brand); border-radius: 4px; padding: 7px 20px; font-weight: 600; font-size: 14px; text-decoration: none; }
.btn:hover:not(:disabled) { background: var(--brand-d); border-color: var(--brand-d); color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover:not(:disabled) { background: var(--bg); color: var(--ink); border-color: #c7c7c7; }
.btn.small { padding: 4px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
.pager select { border: 1px solid var(--line-2); border-radius: 4px; padding: 5px 8px; background: #fff; font-size: 13px; color: var(--sub); min-width: 0; max-width: 60%; }

/* banners */
.banner-msg, .note { border-radius: 6px; padding: 12px 16px; margin: 0 0 12px; font-size: 14px; background: var(--card); box-shadow: var(--shadow); border-left: 4px solid var(--brand); }
.note.ok { border-left-color: var(--ok); background: var(--ok-soft); box-shadow: none; }
.note.warn, .note.bad { border-left-color: var(--bad); background: var(--bad-soft); box-shadow: none; }

/* save toast */
.savebar { position: fixed; right: 20px; bottom: 20px; background: #fff; border-radius: 6px; box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
  padding: 10px 14px; font-size: 13px; border-left: 4px solid var(--ok); opacity: 0; transition: opacity .2s; pointer-events: none; }
.savebar.show { opacity: 1; }
.savebar.err { border-left-color: var(--bad); }

/* dialog */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 8px; box-shadow: 0 8px 32px rgba(0, 0, 0, .24); padding: 24px; width: 100%; max-width: 440px; }
.modal h3 { font-size: 20px; margin-bottom: 8px; }
.modal p { color: var(--sub); margin: 0 0 8px; }
.field { margin: 12px 0; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- admin ---------- */
.admin-head { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.admin-head h1 { font-size: 24px; }
.admin-head .field { margin: 0; }
.admin-head .field input { width: 13em; }
.eyebrow { display: block; color: var(--brand); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 0; }
.kpi { background: var(--card); border-radius: 8px; box-shadow: var(--shadow); padding: 16px 18px; }
.kpi b { display: block; font-size: 28px; font-weight: 600; line-height: 1.1; margin-bottom: 4px; }
.kpi span { font-size: 13px; color: var(--sub); }
.tabs { display: flex; gap: 4px; margin: 18px 0 0; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--sub); font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.panel { background: var(--card); border-radius: 8px; box-shadow: var(--shadow); padding: 18px 20px; margin: 12px 0; }
.panel h3 { font-size: 16px; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--sub); font-size: 12px; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .name { font-weight: 600; font-size: 14px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--zebra); }
tr.detail-row > td { background: var(--bg); padding: 16px; }
.minibar { width: 80px; height: 4px; background: var(--line); border-radius: 2px; display: inline-block; vertical-align: middle; margin-right: 6px; overflow: hidden; }
.minibar span { display: block; height: 4px; background: var(--brand); }
.heat td.cell { text-align: center; font-variant-numeric: tabular-nums; border: 2px solid #fff; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.scroll-x { overflow-x: auto; }
.legend { display: flex; gap: 12px; align-items: center; font-size: 12px; color: var(--sub); margin-top: 10px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 18px; height: 10px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.subcard { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin: 0 0 12px; }
.subcard h3, .subcard h4 { font-size: 16px; margin: 0 0 8px; }
table.mini { font-size: 12px; }
table.mini th, table.mini td { padding: 4px 6px; }
div.mail { background: var(--zebra); border: 1px solid var(--line); border-radius: 4px; padding: 12px; font-size: 13px; max-height: 300px; overflow: auto; margin: 8px 0 0; }
pre.mail { white-space: pre-wrap; background: var(--zebra); border: 1px solid var(--line); border-radius: 4px; padding: 12px; font: 13px/1.45 var(--font); max-height: 280px; overflow: auto; margin: 8px 0 0; }
code { font-size: 12px; }

@media (max-width: 700px) {
  .banner { height: 120px; }
  .banner .label { display: none; }
  .card, .q { padding: 18px 16px; }
  .likert { padding: 14px 12px; }
  .head h1 { font-size: 22px; }
  .pills { flex-direction: column; }
  /* Likert rows become stacked radio lists */
  .lk thead { display: none; }
  .lk, .lk tbody, .lk tr, .lk td { display: block; width: 100%; }
  table.lk { table-layout: auto; }
  .lk tbody tr { border-top: 1px solid var(--line); padding: 10px 0; }
  .lk tbody tr:nth-child(even) td { background: none; }
  .lk tbody td { border: 0; padding: 0; text-align: left; }
  .lk tbody td.stmt { padding: 0 0 6px; }
  .lk td.opt button { display: flex; align-items: center; gap: 10px; width: 100%; border-radius: 4px; padding: 6px 4px; line-height: 1.4; text-align: left; }
  .lk td.opt button .lbl { display: inline; }
  .pager .btn { padding: 7px 14px; }
  .pager { flex-wrap: wrap; }
  .pager select { order: 3; flex: 1 1 100%; max-width: 100%; }
  /* on phones the hint bubble is pinned to the bottom of the screen so it never runs off the edge */
  .info .tip, .lk .info .tip { position: fixed; left: 16px; right: 16px; bottom: 16px; top: auto; transform: none; width: auto; max-width: none; }
  .info .tip::after { display: none; }
}
