/* Patient Surveys: Clinician Admin (sv-) and Adelic Patient My check-ins (svp-). Colors come from site.css variables. */

/* ---------- Clinician Admin ---------- */
#surveysRoot, #surveyPatientRoot, .sv-detail { scroll-margin-top: 110px; }
.sv-admin { display: grid; gap: 22px; }
.sv-intro { margin: 0; font-size: .9rem; max-width: 760px; }
.sv-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.sv-tile { background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--grape); padding: 16px 18px; display: grid; gap: 4px; align-content: start; }
.sv-tile > span { font-size: .66rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.sv-tile b { font-size: 2rem; font-weight: 300; color: var(--plum); line-height: 1.1; }
.sv-tile small { font-size: .8rem; color: var(--muted); }
.sv-tile .sv-how { font-size: .72rem; }
.sv-tile.flag { border-top-color: var(--warn); }
.sv-tile.flag b { color: var(--warn); }
.sv-stars { display: inline-flex; gap: 1px; vertical-align: middle; }
.sv-star { width: 15px; height: 15px; fill: var(--line); }
.sv-star.on { fill: var(--rose); }
.sv-h4 { margin: 10px 0 0; font-size: 1rem; font-weight: 400; }

/* trend chart (inline SVG) */
.sv-chart { width: 100%; height: auto; display: block; }
.sv-ch-title { font-size: 11px; letter-spacing: .08em; fill: var(--muted); }
.sv-ch-axis { font-size: 10.5px; fill: var(--muted); }
.sv-ch-grid { stroke: var(--line); stroke-width: 1; }
.sv-ch-grid.zero { stroke: var(--grape); stroke-dasharray: 3 3; }
.sv-ch-line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.sv-ch-line.stars { stroke: var(--plum); }
.sv-ch-line.nps { stroke: var(--rose-deep); }
.sv-ch-dot { stroke: var(--white); stroke-width: 1.5; }
.sv-ch-dot.stars { fill: var(--plum); }
.sv-ch-dot.nps { fill: var(--rose-deep); }
.sv-ch-val { font-size: 12px; font-weight: 600; }
.sv-ch-val.stars { fill: var(--plum); }
.sv-ch-val.nps { fill: var(--rose-deep); }
.sv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* theme and rating bars */
.sv-bar { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 2.6em; gap: 10px; align-items: center; font-size: .86rem; padding: 3px 0; }
.sv-bar i { display: block; height: 8px; background: var(--beige-soft); border-radius: 4px; overflow: hidden; }
.sv-bar em { display: block; height: 100%; background: var(--grape); border-radius: 4px; }
.sv-bar.low em { background: var(--warn); }
.sv-bar b { font-weight: 500; text-align: right; color: var(--plum); }

/* results list */
.sv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sv-head h3 { margin: 0; }
.sv-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.sv-filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.sv-filters .field select, .sv-filters .field input { width: 100%; min-width: 0; box-sizing: border-box; font: inherit; font-size: .88rem; letter-spacing: 0; text-transform: none; color: var(--charcoal); background-color: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.sv-printed { display: none; }
#svTable td { vertical-align: top; }
#svTable .sv-snip { display: inline-block; max-width: 340px; }
#svTable tr.sv-row-urgent td:first-child { box-shadow: inset 3px 0 0 #A33A3A; }
#svTable tr.sv-row-attn td:first-child { box-shadow: inset 3px 0 0 #C98A1E; }
#svTable tr.sv-row-open td { background: var(--beige-mist); }
.pill.sv-new { background: var(--rose-light); color: var(--plum); }
#svTable .pill { margin: 1px 0; }

/* detail */
.sv-detail { border-left: 3px solid var(--grape); }
.sv-detail:focus { outline: none; }
.sv-d-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.sv-d-head h3 { margin: 2px 0 6px; }
.sv-urgent { margin: 0; }
.sv-anon { margin: 0; background: var(--beige-mist); border: 1px solid var(--line); padding: 10px 14px; font-size: .9rem; }
.sv-reasons { background: #FFF6E8; border: 1px solid #E9C98F; padding: 10px 14px; font-size: .9rem; }
.sv-reasons ul { margin: 4px 0 0; padding-left: 1.1em; }
.sv-answers { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 18px; }
.sv-answers > div { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--beige-soft); font-size: .9rem; }
.sv-answers > div > span:first-child { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.sv-answers b { font-weight: 500; color: var(--plum); }
.sv-answers .sv-low { color: #8E3B3B; }
.sv-comment { margin: 0; padding: 14px 18px; background: var(--beige-mist); border-left: 3px solid var(--rose); font-size: .98rem; line-height: 1.55; white-space: pre-wrap; }
.sv-status { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sv-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
.sv-seg button { font: inherit; font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; background: var(--white); border: 0; border-right: 1px solid var(--line); padding: 8px 14px; cursor: pointer; color: var(--charcoal); }
.sv-seg button:last-child { border-right: 0; }
.sv-seg button[aria-pressed="true"] { background: var(--plum); color: var(--white); }
.sv-seg button:focus-visible { outline: 2px solid var(--rose); outline-offset: -2px; }
.sv-thread ol { list-style: none; margin: 8px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 10px; }
.sv-thread li { font-size: .9rem; }
.sv-thread time { color: var(--muted); font-size: .8rem; margin-left: 8px; }
.sv-thread p { margin: 4px 0 0; white-space: pre-wrap; }
.sv-t-head .pill { margin-left: 8px; }
.sv-t-status { color: var(--muted); }
.sv-t-note { background: var(--beige-mist); padding: 8px 12px; }
.sv-t-reply { background: #F6EEF7; padding: 8px 12px; border-left: 3px solid var(--plum); }
.sv-write form { display: grid; gap: 8px; align-content: start; }
.sv-write textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: .95rem; letter-spacing: 0; text-transform: none; color: var(--charcoal); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; resize: vertical; }
.sv-write .btn { justify-self: start; }

/* asking patients */
.sv-ask { display: grid; gap: 14px; }
.sv-ask > h3 { margin: 8px 0 0; font-size: 1.5rem; }
.sv-ask > .note { margin: 0; }
.sv-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.sv-check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; }
.sv-check input { margin-top: 4px; width: 18px; height: 18px; }
#svSched select { font: inherit; font-size: .84rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; background-color: var(--white); max-width: 230px; }
#svSched select:disabled { color: var(--muted); }

@media (max-width: 960px) { .sv-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sv-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .sv-tiles, .sv-filters { grid-template-columns: minmax(0, 1fr); } .sv-bar { grid-template-columns: minmax(0, 1fr) 80px 2.6em; } }

/* Print report: summary, chart, themes and the results list only */
@media print {
  body.print-surveys header.site, body.print-surveys footer.site, body.print-surveys .pagehead, body.print-surveys .adm-tabs,
  body.print-surveys .comp-alert, body.print-surveys #admStatus, body.print-surveys .cookie-bar, body.print-surveys .sv-noprint,
  body.print-surveys .adm-panel:not([data-panel="surveys"]) { display: none !important; }
  body.print-surveys section.block { padding: 0 !important; }
  body.print-surveys .sv-printed { display: block; font-size: 9pt; color: #555; margin: 0 0 8px; }
  body.print-surveys .adm-card { border: 0; padding: 0; }
  body.print-surveys .sv-charts { grid-template-columns: 1fr 1fr; }
  body.print-surveys .sv-tile { border: 1px solid #ccc; }
  body.print-surveys #svTable { font-size: 9pt; }
  body.print-surveys #svTable tr { break-inside: avoid; }
  body.print-surveys #svTable .sv-snip { max-width: none; }
  body.print-surveys .sv-chart { max-height: 260px; }
  body.print-surveys * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Adelic Patient (My check-ins) ---------- */
.svp { display: grid; gap: 22px; margin: 32px 0; max-width: 760px; }
.svp:focus { outline: none; }
.svp h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.2rem); }
.svp h3 { margin: 0 0 10px; font-size: 1.2rem; }
.svp-lede { margin: 0; font-size: 1.05rem; color: var(--muted); line-height: 1.55; }
.svp-hint { font-size: .88rem; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }
.svp-ok { margin: 0; background: #E3ECE5; color: var(--ok); padding: 12px 16px; border-radius: var(--radius); }
.svp-err { margin: 0; background: #F8E1DF; color: #8E3B3B; padding: 12px 16px; border-radius: var(--radius); }
.svp-block { display: grid; gap: 12px; }
.svp-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; position: relative; }
.svp-waiting { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border-left: 4px solid var(--rose); }
.svp-waiting > div { display: grid; gap: 4px; }
.svp-waiting b { font-size: 1.1rem; color: var(--plum); font-weight: 500; }
.svp-waiting span, .svp-meta { font-size: .88rem; color: var(--muted); }
.svp-reply { border-left: 4px solid var(--plum); background: #F6EEF7; }
.svp-reply.is-new { box-shadow: 0 0 0 2px var(--rose-light); }
.svp-reply-text { margin: 0 0 8px; font-size: 1.02rem; line-height: 1.55; white-space: pre-wrap; }
.svp-tag { display: inline-block; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; background: var(--plum); color: var(--white); padding: 3px 9px; border-radius: 20px; margin-bottom: 8px; }
.svp-choose { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.svp-pick { font: inherit; text-align: left; cursor: pointer; display: grid; gap: 6px; min-height: 96px; transition: border-color .15s, box-shadow .15s; }
.svp-pick b { font-size: 1.1rem; color: var(--plum); font-weight: 500; }
.svp-pick span { font-size: .92rem; color: var(--muted); line-height: 1.45; }
.svp-pick:hover, .svp-pick:focus-visible { border-color: var(--rose); box-shadow: var(--shadow); outline: none; }
.svp-past { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.svp-past li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.svp-past li > div { display: grid; gap: 2px; }
.svp-past-r { text-align: right; justify-items: end; }
.svp-past details { flex: 1 1 100%; font-size: .92rem; }
.svp-past summary { cursor: pointer; color: var(--rose-deep); padding: 6px 0; }
.svp-past details p { margin: 4px 0 0; white-space: pre-wrap; }
.svp-mini { display: inline-flex; gap: 2px; }
.svp-mini svg { width: 16px; height: 16px; fill: var(--rose); }

/* buttons: large and touch friendly */
.svp-btn { font: inherit; font-size: 1rem; font-weight: 500; min-height: 52px; padding: 12px 26px; border-radius: 30px; border: 1px solid var(--rose); background: var(--white); color: var(--rose-deep); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.svp-btn:hover { text-decoration: none; border-color: var(--rose-deep); }
.svp-btn:focus-visible, .svp-link:focus-visible { outline: 3px solid var(--rose-light); outline-offset: 2px; }
.svp-primary { background: var(--rose-grad); color: var(--white); border-color: transparent; }
.svp-primary[disabled] { opacity: .6; cursor: default; }
.svp-link { font: inherit; background: none; border: 0; color: var(--rose-deep); cursor: pointer; padding: 8px 0; justify-self: start; font-size: .95rem; }
.svp-link::before { content: ""; display: inline-block; width: 7px; height: 7px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin-right: 8px; }

/* the form */
#svpForm { display: grid; gap: 18px; }
.svp-q { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 18px 18px 20px; margin: 0; min-width: 0; }
.svp-q.is-off { opacity: .6; }
.svp-q legend, .svp-qtitle { font-size: 1.08rem; color: var(--plum); font-weight: 500; padding: 0 4px; line-height: 1.4; display: block; margin: 0 0 10px; }
.svp-q > .svp-qtitle { padding: 0; }
.svp-q textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 1rem; color: var(--charcoal); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; resize: vertical; min-height: 110px; }
.svp-q textarea:focus { outline: 2px solid var(--rose-light); border-color: var(--rose); }
.svp-scale input, .svp-stars input, .svp-who input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.svp-scale { display: flex; flex-wrap: wrap; gap: 8px; }
.svp-scale label { flex: 1 1 0; min-width: 48px; }
.svp-scale span { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--beige-mist); cursor: pointer; font-size: 1.05rem; color: var(--charcoal); text-align: center; transition: background .12s, border-color .12s; }
.svp-scale small { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.svp-scale input:checked + span { background: var(--plum); border-color: var(--plum); color: var(--white); }
.svp-scale input:checked + span small { color: var(--rose-light); }
.svp-scale input:focus-visible + span, .svp-stars input:focus-visible + svg, .svp-who input:focus-visible + span { outline: 3px solid var(--rose-light); outline-offset: 2px; }
.svp-scale input:disabled + span { cursor: not-allowed; }
.svp-nps label { min-width: 44px; }
.svp-five label:last-child { flex: 1.6 1 0; }
.svp-five label:last-child span { font-size: .85rem; }
.svp-opts label { flex: 0 1 auto; min-width: 120px; }
.svp-ends { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); margin-top: 6px; }
.svp-item { border: 0; padding: 12px 0 0; margin: 0; min-width: 0; }
.svp-item + .svp-item { border-top: 1px solid var(--beige-soft); margin-top: 10px; }
.svp-item legend { font-size: .98rem; color: var(--charcoal); padding: 0; margin-bottom: 8px; }
.svp-stars { display: flex; gap: 6px; flex-wrap: wrap; }
.svp-stars label { display: grid; justify-items: center; gap: 4px; cursor: pointer; min-width: 56px; flex: 1 1 0; padding: 6px 0; }
.svp-stars svg { width: 46px; height: 46px; fill: var(--beige-soft); stroke: var(--grape); stroke-width: .8; transition: fill .12s; border-radius: 6px; }
.svp-stars span { font-size: .78rem; color: var(--muted); }
.svp-stars:has(input:checked) label svg { fill: var(--rose); stroke: var(--rose); }
.svp-stars label:has(input:checked) ~ label svg { fill: var(--beige-soft); stroke: var(--grape); }
.svp-stars label:has(input:checked) span { color: var(--plum); font-weight: 600; }
.svp-who { display: grid; gap: 10px; }
.svp-who label { cursor: pointer; }
.svp-who span { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--beige-mist); font-size: .92rem; color: var(--muted); line-height: 1.45; }
.svp-who b { color: var(--plum); font-size: 1rem; font-weight: 500; }
.svp-who input:checked + span { border-color: var(--plum); box-shadow: inset 4px 0 0 var(--plum); background: var(--white); }
.svp-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* thank-you screen */
.svp-crisis { background: #FBEDEC; border: 1px solid #E2B3B0; border-left: 5px solid #A33A3A; border-radius: var(--radius); padding: 18px 20px; }
.svp-crisis h3 { color: #8E3B3B; margin: 0 0 8px; }
.svp-crisis p { margin: 0 0 10px; line-height: 1.55; }
.svp-crisis ul { margin: 0; padding-left: 1.1em; display: grid; gap: 10px; line-height: 1.5; }
.svp-call { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.svp-crisis a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 24px; background: #A33A3A; color: #fff; font-weight: 600; text-decoration: none; }
.svp-review { display: grid; gap: 12px; justify-items: start; border-left: 4px solid var(--grape); }
.svp-review p { margin: 0; line-height: 1.5; }
.svp-thanks > .svp-btn { justify-self: start; }

@media (max-width: 560px) {
  .svp-q { padding: 14px 12px 16px; }
  .svp-nps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .svp-nps label { min-width: 0; }
  .svp-five { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .svp-five label { min-width: 0; }
  .svp-five label:last-child { grid-column: 1 / -1; }
  .svp-five small { display: none; }
  .svp-stars svg { width: 40px; height: 40px; }
  .svp-stars label { min-width: 0; }
  .svp-actions .svp-btn, .svp-waiting .svp-btn { flex: 1 1 100%; }
  .svp-past-r { text-align: left; justify-items: start; }
}
