/* Surveys (surveys.js): the Surveys page, Recent surveys on Home and a survey's tab. Report Metric's purple marks
   what goes there, as Survey mode does on the iPhone (SurveyStyle: #4D3069, #2B1A3B, #E9E2EC). */
:root { --sv: #4D3069; --sv-deep: #2B1A3B; --sv-soft: #E9E2EC; --sv-ink: #4D3069; }
:root[data-theme="dark"] { --sv-soft: rgba(184,172,195,.16); --sv-ink: #C9B6E0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sv-soft: rgba(184,172,195,.16); --sv-ink: #C9B6E0; } }

.mlayout[data-tab="survey"] [data-pane="survey"] { display: block; }
/* Six tabs on a phone: a little tighter, and they scroll rather than squeeze. */
.mtabs:has(#tab-survey) { overflow-x: auto; scrollbar-width: none; }
.mtabs:has(#tab-survey)::-webkit-scrollbar { display: none; }
.mtabs:has(#tab-survey) .mtab { flex: 1 0 auto; padding: 9px 7px; font-size: 14px; }

/* Thumbnails: filled in as each photo arrives from the server. */
.sv-thumb { position: relative; display: grid; place-items: center; overflow: hidden; background: var(--sv-soft); color: var(--sv-ink); border-radius: 12px; aspect-ratio: 4 / 3; }
.sv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sv-thumb .ico-svg { width: 22px; height: 22px; opacity: .7; }
.sv-thumb.loading::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); background-size: 200% 100%; animation: sv-shimmer 1.2s linear infinite; }
@keyframes sv-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .sv-thumb.loading::after { animation: none; } }
.sv-thumb.sm { width: 64px; flex: none; border-radius: 8px; }
.sv-thumb.big { width: 100%; aspect-ratio: auto; min-height: 200px; max-height: 70vh; border-radius: 14px; }
.sv-thumb.big img { object-fit: contain; max-height: 70vh; background: #000; }
.sv-thumb.cover { width: 100%; border-radius: 0; aspect-ratio: 16 / 9; }

/* The Report Metric card on a survey. */
.sv-rm { border-left: 4px solid var(--sv); }
.sv-rm .eyebrow { color: var(--sv-ink); }
.sv-rm-what { margin: 6px 0 12px; }
.sv-rm-actions { flex-wrap: wrap; gap: 8px; }
.sv-rm .btn.primary, .sv-rm-slot .btn { background: var(--sv); border-color: var(--sv); color: #fff; }
.bar .sv-rm-slot .btn { background: var(--sv); border-color: var(--sv); color: #fff; }
.sv-glance { margin: 0 0 12px; }
.sv-glance .glance-pill { cursor: default; }

/* Photos. */
.sv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sv-tile { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.sv-tile:hover .sv-thumb { outline: 2px solid var(--sv); outline-offset: 1px; }
.sv-tile-meta { display: flex; gap: 6px; font-size: 12.5px; line-height: 1.3; min-width: 0; }
.sv-tile-meta b { font-variant-numeric: tabular-nums; color: var(--sv-ink); flex: none; }
.sv-tile-meta span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Measured. */
.sv-mlist { display: flex; flex-direction: column; }
.sv-mrow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) auto auto; gap: 4px 12px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.sv-mrow:first-child { border-top: 0; }
.sv-mname { display: flex; flex-direction: column; min-width: 0; }
.sv-mval { font-variant-numeric: tabular-nums; }
.sv-mprice { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; min-width: 56px; }
.sv-mnote { grid-column: 1 / -1; margin: 0; }
.sv-status { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); white-space: nowrap; }
.sv-status.ok { background: var(--ok-soft); color: var(--ok); }
.sv-mtotal { display: flex; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 2px solid var(--line); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .sv-mrow { grid-template-columns: minmax(0, 1fr) auto; }
  .sv-mval { grid-column: 1 / -1; }
}

/* The walk round. */
.sv-walk { display: flex; flex-direction: column; gap: 2px; }
.sv-line { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; line-height: 1.45; }
.sv-line .sv-at, .sv-at { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; flex: none; min-width: 44px; padding-top: 1px; }
.sv-line.head { font-weight: 700; }
.sv-line.note { color: var(--muted); font-size: 13px; }
.sv-line.heading { font-weight: 700; margin-top: 10px; }
.sv-line.notes { white-space: pre-wrap; }
.sv-line.photo { border: 0; background: var(--sv-soft); color: var(--sv-ink); border-radius: 10px; padding: 6px; margin: 4px 0; text-align: left; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; align-items: center; }
.sv-line.mark { color: var(--mark); font-weight: 600; align-items: center; }
.sv-line.mark .ico-svg { width: 16px; height: 16px; }
.sv-raw { white-space: pre-wrap; word-break: break-word; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; background: var(--raised); border-radius: 12px; padding: 14px; margin: 0; max-height: 70vh; overflow: auto; }

/* A photo large. */
.dialog.sv-viewer { max-width: min(920px, 96vw); }
.sv-view { display: flex; flex-direction: column; gap: 12px; }
.sv-view-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.sv-view-meta p { flex-basis: 100%; margin: 0; }
.sv-view-nav { justify-content: space-between; align-items: center; }

/* Survey cards: the Surveys page and Home. */
.sv-intro { margin: -4px 0 14px; max-width: 70ch; }
.sv-search { max-width: 460px; margin-bottom: 14px; }
.sv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.sv-card { display: flex; flex-direction: column; border-radius: 20px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; box-shadow: 0 1px 2px rgba(15,42,68,.05); transition: transform .15s, box-shadow .15s; }
.sv-card:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -16px rgba(43,26,59,.55); }
.sv-card-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; }
.sv-card-top { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.sv-tag { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sv-ink); }
.sv-when { margin-left: auto; color: var(--muted); }
.sv-card-title { font-size: 15.5px; line-height: 1.3; }
.sv-card-project { font-size: 13px; color: var(--sv-ink); font-weight: 600; }
.sv-card-meta { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.rail.sv-rail > .sv-card { width: min(280px, 78vw); }
@media (min-width: 861px) { .rail.sv-rail > .sv-card { width: auto; } }
