@font-face {
  font-family: Sora;
  src: url("/assets/sora-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #202238;
  --muted: #555b72;
  --line: #d9dce6;
  --page: #f5f5fa;
  --sheet: white;
  --action: #593b88;
  --pale: #f2edf8;
  --aqua: #6fbfcd;
  --violet: #883c9c;
  --gutter: clamp(1.15rem, 4vw, 2.65rem);
  --wash: linear-gradient(122deg, var(--aqua) 0%, #759fc1 34%, #825ba7 72%, var(--violet) 100%);
  font: 100%/1.48 Sora, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0 0 .75rem; }
h1, h2 { line-height: 1.08; font-weight: 700; letter-spacing: -.045em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.5vw, 3.15rem); }
h2 { font-size: clamp(1.55rem, 3vw, 2.3rem); }
h3 { font-size: 1.1rem; }
p { max-width: 68ch; }
a { color: var(--action); text-underline-offset: .16em; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button, .btn {
  min-height: 44px; padding: .63rem 1.08rem; border: 1px solid transparent;
  border-radius: .7rem; color: #fff; background: var(--action); font-weight: 600; line-height: 1.25;
  transition: background-color .15s ease, border-color .15s ease;
}
button:hover { background-color: #48316e; }
button:disabled { opacity: .65; cursor: wait; }
button.secondary { background: white; color: var(--action); border-color: #b8abc9; }
button.secondary:hover { background: var(--pale); }
:focus-visible { outline: 3px solid #7148a3; outline-offset: 3px; }
h1:focus, h2:focus { outline: none; }
.bar {
  background: var(--sheet); border-bottom: 1px solid var(--line);
  padding: .85rem max(1.15rem, calc((100vw - 61rem) / 2));
  display: flex; align-items: center; justify-content: space-between; gap: .7rem;
}
.brand-lockup { display: flex; align-items: center; gap: 1.05rem; min-width: 0; }
.brand-logo { display: block; width: clamp(6.9rem, 13vw, 9rem); height: auto; flex: none; }
.study { padding-left: 1rem; border-left: 1px solid var(--line); line-height: 1.2; color: var(--muted); font-size: .88rem; font-weight: 550; }
.bar button { background: transparent; color: var(--ink); border-color: var(--line); white-space: nowrap; }
.bar button:hover { background: var(--page); }
.shell { width: min(100%, 64rem); margin: 0 auto; padding: 0 1.5rem 4rem; }
.paper {
  border: 1px solid var(--line); border-radius: 1.15rem; background: var(--sheet);
  padding: var(--gutter); box-shadow: 0 5px 24px #2827440a;
}
.device { display: flex; align-items: center; justify-content: space-between; gap: .35rem 1rem; flex-wrap: wrap; padding: 1rem .25rem; }
.device > div:first-child { display: flex; align-items: baseline; gap: .18rem 1rem; flex-wrap: wrap; }
.device strong { display: inline-flex; align-items: center; gap: .45rem; font-size: .88rem; font-weight: 650; }
.device strong::before { content: ""; width: .52rem; height: .52rem; flex: none; border-radius: 50%; background: #8c739d; }
.device strong[data-ready="true"]::before { background: #23816c; }
.device p, .stepcount, .minor, .note, .log-meta, .log-subject, small { color: var(--muted); }
.device p { margin: 0; font-size: .83rem; }
.device-actions, .log-primary-actions, .actions { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.device-actions:not(:has(:not([hidden]))) { display: none; }
.log-heading, .login-heading {
  position: relative; isolation: isolate; overflow: hidden;
  margin: calc(0px - var(--gutter)) calc(0px - var(--gutter)) 0;
  border-radius: 1.1rem 1.1rem 0 0;
  background: var(--wash); color: #17182e;
  padding: 1.75rem var(--gutter); min-height: 8.4rem;
  display: flex; align-items: center; justify-content: space-between; gap: .85rem; flex-wrap: wrap;
}
.log-heading::before, .login-heading::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url("/assets/niue-coast.svg") no-repeat 67% center / auto 140%;
}
.log-heading h1, .login-heading h1 { margin: 0; }
.log-heading button { background: white; color: #382750; border: 1px solid #ffffff99; }
.log-heading button:hover { background: #f6effc; }
#visit-add::before { content: "+"; margin-right: .46rem; font-weight: 500; }
.log-back { padding-inline: 0; border: 0; border-radius: 0; background: transparent; color: var(--action); margin-bottom: .5rem; }
.log-back:hover { color: var(--action); background: transparent; }
.minor, .note, .log-summary, .log-meta, .log-subject { font-size: .92rem; }
#visit-route-hint { max-width: 77ch; margin: 1.2rem 0; }
.log-filters { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1.4fr); gap: .75rem; }
label.block, .log-filters label, .log-editor label { display: block; font-weight: 650; }
.log-filters label, .log-editor label { font-size: .92rem; }
input:not([type="radio"]):not([type="checkbox"]), textarea, select {
  width: 100%; min-width: 0; min-height: 45px; display: block;
  padding: .62rem .72rem; margin: .32rem 0; border: 1px solid #9399ac;
  border-radius: .58rem; background: white; color: var(--ink); font-size: 1rem; font-weight: 400;
}
input[readonly] { background: var(--page) !important; }
select {
  appearance: none; -webkit-appearance: none; height: 45px; padding-right: 1.85rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1rem) center, calc(100% - .7rem) center;
  background-size: .32rem .32rem; background-repeat: no-repeat;
}
@media (forced-colors: active) {
  select { appearance: auto; background-image: none; }
}
textarea { min-height: 6rem; resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--action); width: 1.12rem; height: 1.12rem; flex: none; margin: .13rem 0 0; }
.log-summary { margin: 1.2rem 0 .45rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.log-rows, .log-history { list-style: none; padding: 0; margin: 0; }
.log-rows li, .log-history li { border-top: 1px solid var(--line); }
.log-entry {
  display: grid; grid-template-columns: minmax(0,1fr) auto .6rem; align-items: center; gap: .8rem;
  width: 100%; padding: .93rem .3rem; text-align: left; font-weight: 550; line-height: 1.37;
  border: none; border-radius: .2rem; background: transparent; color: var(--ink);
}
.log-entry::after { content: ""; width: .42rem; height: .42rem; border: solid #8e849a; border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); }
.log-entry:hover, .log-entry:focus-visible { background: #f6f3fa; }
.log-entry strong, .log-entry small, #visit-name, .log-subject, .log-meta, #visit-location, #visit-source-note { overflow-wrap: anywhere; }
.log-entry strong, .log-entry small { display: block; }
.log-entry small { margin-top: .19rem; font-weight: 400; font-size: .83rem; }
.log-status { color: var(--muted); font-size: .83rem; text-align: right; }
.log-status[data-status="A"], .log-status[data-status="P"] { color: #8a4e06; }
.log-status[data-status="C"] { color: #196552; }
#visit-empty { padding: 1.2rem 0; color: var(--muted); }
.log-meta, .log-subject { margin-bottom: .5rem; }
.log-subject { font-weight: 650; }
.log-state { display: table; color: #4c3c66; background: var(--pale); padding: .22rem .68rem; border-radius: .45rem; margin: .95rem 0; font-size: .9rem; font-weight: 600; }
.log-phone { display: inline-block; padding: .5rem 0; }
.log-subheading { margin: 2rem 0 .65rem; font-size: 1.3rem; }
.log-history li { padding: .7rem 0; }
.log-history time { display: block; color: var(--muted); font-size: .85rem; }
.log-history p { margin: .2rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-editor { max-width: 37rem; }
.log-editor > label, .log-editor details > label, #visit-callback-fields > label, label.block { margin-top: .82rem; }
.log-editor details { margin: .75rem 0; }
.log-editor summary { color: var(--action); padding-block: .6rem; cursor: pointer; }
.log-editor .log-primary-actions { margin-top: 1.2rem; }
#visit-outcome-form { padding: 1.25rem 0; border-block: 1px solid var(--line); margin: 1.1rem 0; }
#visit-outcome-form h2 { font-size: 1.45rem; }
.log-pair, .inline { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,12rem),1fr)); gap: .25rem 1rem; }
fieldset { min-width: 0; padding: 0; border: 0; margin: 1.15rem 0 0; }
legend { width: 100%; padding: 0; font-weight: 700; margin: 0 0 .45rem; }
.log-kind label { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; margin-right: 1.25rem; }
.log-kind input { margin: 0; }
#questionnaire-view { max-width: 51rem; margin: auto; }
.nav { display: flex; list-style: none; margin: .8rem 0 1.1rem; padding: 0; gap: .3rem; }
.nav li { flex: 1; padding: .45rem .12rem; border-top: 3px solid #d4d3e0; font-size: .84rem; color: var(--muted); }
.nav li[aria-current="step"] { border-color: var(--action); color: var(--action); font-weight: 700; }
.stepcount { margin: 0 0 .6rem; font-weight: 650; font-size: .85rem; }
.q { border-top: 1px solid var(--line); margin-top: 1.35rem; padding-top: .25rem; }
.opts { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,15rem),1fr)); gap: .15rem .85rem; }
.opt { display: flex; align-items: flex-start; gap: .57rem; min-height: 44px; padding: .55rem .4rem; border-radius: .36rem; cursor: pointer; }
.opt:hover, .opt:has(input:checked) { background: var(--pale); }
.matrix { border-collapse: collapse; width: 100%; }
.matrix th, .matrix td { border-bottom: 1px solid var(--line); padding: .3rem .2rem; text-align: center; }
.matrix th:first-child { text-align: left; }
.matrix thead { font-size: .86rem; color: var(--action); }
.matrix th[scope="row"] { font-weight: 500; }
.matrix label { display: grid; place-items: center; min-width: 40px; min-height: 44px; cursor: pointer; }
.matrix input { margin: 0; }
.actions { justify-content: space-between; margin-top: 1.7rem; }
.actions #next { margin-left: auto; }
.note { margin-top: 1.15rem; }
.alert { font-weight: 650; color: #9c2534; }
.alert:not(:empty) { margin: .8rem 0; }
.login { max-width: 40rem; padding-top: clamp(2rem,9vh,6rem); }
.login .paper { padding-bottom: var(--gutter); }
.login-heading { min-height: 10.5rem; }
.login-heading::before { background-position: 93% center; background-size: auto 112%; }
#login { margin-top: 1.6rem; }
#login p { margin-bottom: 1.15rem; color: var(--muted); }
#login button { margin-top: .8rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 660px) {
  .shell { padding-inline: .65rem; }
  .bar { padding: .65rem 1rem; }
  .device { padding: .8rem .45rem; }
  .log-filters { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem; }
  .log-filters label:last-child { grid-column: 1 / -1; }
  .log-heading { align-items: flex-start; flex-direction: column; justify-content: center; }
  .log-heading::before { background-position: right -1rem center; background-size: auto 109%; }
  .log-entry { gap: .52rem; }
  .log-status { max-width: 6.5rem; }
  .nav li { font-size: .76rem; }
  .matrix { font-size: .89rem; }
  .brand-lockup { gap: .65rem; }
  .study { padding-left: .65rem; max-width: 7.2rem; font-size: .8rem; }
  .login { padding-top: 1.45rem; }
}
@media (max-width: 380px) {
  .bar { padding-inline: .7rem; }
  .brand-logo { width: 5.9rem; }
  .log-status { max-width: 5.2rem; }
  .log-filters { grid-template-columns: minmax(0,1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
