/* DocFila Forms — respondent surface. Theme arrives as --f-* custom properties (schema.js themeVars). */

.fr {
  --f-bg: #F6F4EE; --f-surface: #fff; --f-ink: #14141A; --f-muted: #76767F; --f-line: rgba(20,20,26,.12);
  --f-accent: #3B49DF; --f-on-accent: #fff; --f-accent-soft: rgba(59,73,223,.1); --f-radius: 12px;
  --f-title-font: var(--serif); --f-title-weight: 400; --f-title-track: -0.02em;
  position: relative; min-height: 100vh; min-height: 100dvh; color: var(--f-ink);
  isolation: isolate; overflow-x: hidden;
}
.fr-bg { position: fixed; inset: 0; z-index: -1; background: var(--f-bg); }
.fr-bg::after { content: ""; position: absolute; inset: 0; background-image: var(--grain); opacity: .8; pointer-events: none; }
.fr-preview { position: relative; min-height: 100%; }
.fr-preview .fr-bg { position: absolute; }
.fr-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* Head */
.fr-head { margin-bottom: 40px; }
.fr-head.is-compact { margin-bottom: 20px; }
.fr-head.is-compact .fr-title { font-size: 22px; opacity: .65; }
.fr-title { font-family: var(--f-title-font); font-weight: var(--f-title-weight); letter-spacing: var(--f-title-track); font-size: clamp(34px, 5vw, 52px); line-height: 1.04; margin: 0 0 14px; text-wrap: balance; }
.fr-title-xl { font-size: clamp(40px, 7vw, 72px); }
.fr-desc { font-size: 17px; line-height: 1.6; color: var(--f-muted); margin: 0; max-width: 60ch; white-space: pre-line; text-wrap: pretty; }
.fr-page-title { font: 600 13px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--f-muted); margin: 0 0 28px; }
.fr-eyebrow { font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--f-muted); margin: 0 0 22px; }

/* Progress */
.fr-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 20; background: transparent; }
.fr-preview .fr-progress { position: absolute; }
.fr-progress span { display: block; height: 100%; background: var(--f-accent); transform-origin: left; transition: transform .5s var(--ease-out); border-radius: 0 3px 3px 0; }

/* Classic */
.fr-classic { padding: clamp(40px, 9vh, 96px) 16px 120px; }
.fr-sheet { max-width: 680px; margin: 0 auto; animation: rise .5s var(--ease-out); }
.fr-blocks { display: grid; gap: 14px; }
.fr-block { background: var(--f-surface); border: 1px solid var(--f-line); border-radius: calc(var(--f-radius) + 4px); padding: 26px 26px 24px; transition: border-color .2s var(--ease), box-shadow .2s var(--ease); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.fr-block:focus-within { border-color: color-mix(in srgb, var(--f-accent) 50%, var(--f-line)); box-shadow: 0 0 0 4px var(--f-accent-soft); }
.fr-block:has(.q-statement) { background: transparent; border-color: transparent; padding: 10px 2px; box-shadow: none; backdrop-filter: none; }
.fr-block:has(.q-has-error) { border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
.fr-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 12px; }
.fr-empty { color: var(--f-muted); text-align: center; padding: 40px 0; }

/* Buttons */
.fr-btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 48px; padding: 0 22px; border-radius: var(--f-radius); border: 1px solid transparent; font-weight: 600; font-size: 15.5px; transition: transform .14s var(--ease), filter .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease); -webkit-tap-highlight-color: transparent; }
.fr-btn:active { transform: translateY(1px) scale(.985); }
.fr-btn[disabled] { opacity: .6; pointer-events: none; }
.fr-btn-primary { background: var(--f-accent); color: var(--f-on-accent); box-shadow: 0 10px 24px -12px var(--f-accent), inset 0 1px 0 rgba(255,255,255,.18); }
.fr-btn-primary:hover { filter: brightness(1.07) saturate(1.05); }
.fr-btn-ghost { background: transparent; color: var(--f-ink); border-color: var(--f-line); }
.fr-btn-ghost:hover { background: var(--f-accent-soft); }
.fr-btn-lg { height: 56px; padding: 0 30px; font-size: 17px; }
.fr-spin { width: 16px; height: 16px; border-color: color-mix(in srgb, var(--f-on-accent) 35%, transparent); border-top-color: var(--f-on-accent); }
.fr-hint { font-size: 12.5px; color: var(--f-muted); display: inline-flex; gap: 6px; align-items: center; }
.fr .kbd { background: var(--f-accent-soft); border-color: transparent; color: var(--f-ink); }
.fr-send-error { display: flex; gap: 8px; align-items: center; color: var(--bad); font-weight: 550; font-size: 14px; margin: 6px 0 0; }

/* Questions */
.q { border: 0; margin: 0; padding: 0; min-width: 0; }
.q-title { display: flex; gap: 6px; align-items: baseline; font-size: 17.5px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.35; margin: 0 0 6px; padding: 0; color: var(--f-ink); text-wrap: pretty; }
.q-req { color: var(--f-accent); font-weight: 700; }
.q-help { margin: 0 0 4px; color: var(--f-muted); font-size: 14.5px; white-space: pre-line; }
.q-title + .f-input, .q-help + .f-input, .q-title + .f-select-wrap, .q-help + .f-select-wrap { margin-top: 12px; }
.q > :is(.f-choices, .f-yesno, .f-rating, .f-scale-wrap, .f-rank, .f-matrix, .f-sig) { margin-top: 16px; }
.q-error { display: flex; align-items: center; gap: 7px; margin: 12px 0 0; color: var(--bad); font-size: 13.5px; font-weight: 550; animation: shake .32s var(--ease); }
@keyframes shake { 20% { transform: translateX(-3px); } 40% { transform: translateX(3px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(1px); } }

.f-input { width: 100%; background: transparent; border: 0; border-bottom: 1.5px solid var(--f-line); border-radius: 0; padding: 10px 0 11px; font-size: 17px; color: var(--f-ink); outline: none; transition: border-color .2s var(--ease); -webkit-appearance: none; appearance: none; }
.f-input::placeholder { color: color-mix(in srgb, var(--f-muted) 70%, transparent); }
.f-input:focus { border-bottom-color: var(--f-accent); box-shadow: 0 1.5px 0 0 var(--f-accent); }
.f-input[aria-invalid="true"] { border-bottom-color: var(--bad); }
.f-input[type="date"], .f-input[type="time"] { max-width: 260px; min-height: 46px; }
.f-textarea { resize: none; line-height: 1.55; min-height: 52px; overflow: hidden; }
.f-select-wrap { position: relative; max-width: 420px; }
.f-select { padding-right: 36px; cursor: pointer; }
.f-select option { color: #111; }
.f-select-ico { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: var(--f-muted); pointer-events: none; }
.f-count { margin: 8px 0 0; font-size: 12.5px; color: var(--f-muted); }
.f-kbd-hint { margin: 10px 0 0; font-size: 12px; color: var(--f-muted); }
.f-link-btn { border: 0; background: none; padding: 0; color: var(--f-accent); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Choices */
.f-choices { display: grid; gap: 8px; max-width: 520px; }
.f-choices-cols { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); max-width: none; }
.f-yesno { display: grid; grid-template-columns: repeat(2, minmax(0, 200px)); gap: 10px; }
.f-choice { position: relative; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 10px 14px 10px 10px; border-radius: var(--f-radius); border: 1px solid var(--f-line); background: color-mix(in srgb, var(--f-surface) 70%, transparent); cursor: pointer; transition: border-color .18s var(--ease), background .18s var(--ease), transform .12s var(--ease), box-shadow .18s var(--ease); user-select: none; -webkit-tap-highlight-color: transparent; }
.f-choice:hover { border-color: color-mix(in srgb, var(--f-accent) 55%, var(--f-line)); background: var(--f-accent-soft); }
.f-choice:active { transform: scale(.992); }
.f-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.f-choice:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--f-accent-soft), 0 0 0 1.5px var(--f-accent); }
.f-key { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: calc(var(--f-radius) * .55); border: 1px solid var(--f-line); font: 600 12px/1 var(--mono); color: var(--f-muted); background: var(--f-surface); transition: all .18s var(--ease); }
.f-choice-label { flex: 1; font-size: 15.5px; line-height: 1.35; }
.f-tick { flex: none; color: var(--f-accent); opacity: 0; transform: scale(.6); transition: opacity .18s var(--ease), transform .25s var(--ease-out); }
.f-choice.is-on { border-color: var(--f-accent); background: var(--f-accent-soft); box-shadow: inset 0 0 0 .5px var(--f-accent); }
.f-choice.is-on .f-key { background: var(--f-accent); color: var(--f-on-accent); border-color: var(--f-accent); }
.f-choice.is-on .f-tick { opacity: 1; transform: none; }
.f-choice-other { cursor: default; }
.f-other-input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 15.5px; color: var(--f-ink); padding: 4px 0; border-bottom: 1px dashed var(--f-line); }
.f-other-input:focus { border-bottom-color: var(--f-accent); }
.f-yn .f-choice-label { font-weight: 600; }

/* Rating */
.f-rating { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.f-star { position: relative; color: color-mix(in srgb, var(--f-muted) 55%, transparent); cursor: pointer; padding: 3px; border-radius: 10px; transition: transform .16s var(--ease-out), color .16s var(--ease); }
.f-star:hover { transform: scale(1.12); }
.f-star.is-on { color: var(--f-accent); }
.f-star input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.f-star:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--f-accent-soft); }
.f-rating-val { margin-left: 10px; font: 600 14px/1 var(--mono); color: var(--f-muted); }

/* Scale + NPS */
.f-scale { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 6px; max-width: 640px; }
.f-scale-btn { position: relative; display: grid; place-items: center; height: 50px; border-radius: var(--f-radius); border: 1px solid var(--f-line); background: color-mix(in srgb, var(--f-surface) 70%, transparent); font: 600 15px/1 var(--sans); cursor: pointer; transition: all .16s var(--ease); -webkit-tap-highlight-color: transparent; }
.f-scale-btn:hover { border-color: var(--f-accent); background: var(--f-accent-soft); }
.f-scale-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.f-scale-btn:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--f-accent-soft), 0 0 0 1.5px var(--f-accent); }
.f-scale-btn.is-on { background: var(--f-accent); color: var(--f-on-accent); border-color: var(--f-accent); transform: translateY(-2px); box-shadow: 0 8px 18px -10px var(--f-accent); }
.f-nps .f-scale-btn.is-on.t-detractor { background: #E5484D; border-color: #E5484D; color: #fff; box-shadow: 0 8px 18px -10px #E5484D; }
.f-nps .f-scale-btn.is-on.t-passive { background: #E2A336; border-color: #E2A336; color: #1a1205; box-shadow: 0 8px 18px -10px #E2A336; }
.f-nps .f-scale-btn.is-on.t-promoter { background: #16A06B; border-color: #16A06B; color: #fff; box-shadow: 0 8px 18px -10px #16A06B; }
.f-scale-labels { display: flex; justify-content: space-between; max-width: 640px; margin-top: 10px; font-size: 13px; color: var(--f-muted); gap: 16px; }
.f-scale-labels span:last-child { text-align: right; }

/* Ranking */
.f-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 520px; }
.f-rank-item { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 8px 8px 10px; border-radius: var(--f-radius); border: 1px solid var(--f-line); background: var(--f-surface); cursor: grab; transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease); }
.f-rank-item.is-drag { box-shadow: 0 16px 30px -14px rgba(0,0,0,.35); border-color: var(--f-accent); transform: scale(1.015); }
.f-rank-item.is-set .f-rank-n { background: var(--f-accent); color: var(--f-on-accent); border-color: transparent; }
.f-rank-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 600 12px/1 var(--mono); border: 1px solid var(--f-line); color: var(--f-muted); flex: none; transition: all .2s var(--ease); }
.f-rank-grip { color: var(--f-muted); opacity: .6; }
.f-rank-label { flex: 1; font-size: 15.5px; }
.f-rank-btns { display: flex; gap: 2px; }
.f-icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--f-muted); }
.f-icon-btn:hover:not([disabled]) { background: var(--f-accent-soft); color: var(--f-ink); }
.f-icon-btn[disabled] { opacity: .3; }

/* Matrix */
.f-matrix-scroll { overflow-x: auto; }
.f-matrix table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
.f-matrix th { font-weight: 550; color: var(--f-muted); padding: 8px 6px; text-align: center; font-size: 13px; }
.f-matrix tbody th { text-align: left; color: var(--f-ink); font-size: 14.5px; padding-left: 0; min-width: 120px; }
.f-matrix td { text-align: center; padding: 6px; border-top: 1px solid var(--f-line); }
.f-matrix tbody th { border-top: 1px solid var(--f-line); }
.f-mx { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; cursor: pointer; border-radius: 50%; }
.f-mx input { position: absolute; opacity: 0; }
.f-mx span { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--f-line); transition: all .16s var(--ease); background: var(--f-surface); }
.f-mx:hover span { border-color: var(--f-accent); }
.f-mx.is-on span { border: 6px solid var(--f-accent); }
.f-mx:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--f-accent-soft); }
.f-matrix-stack { display: none; }
.f-mx-row { padding: 12px 0; border-top: 1px solid var(--f-line); }
.f-mx-row-title { margin: 0 0 10px; font-weight: 550; }
.f-mx-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.f-pill { position: relative; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--f-line); font-size: 14px; cursor: pointer; transition: all .16s var(--ease); }
.f-pill input { position: absolute; opacity: 0; }
.f-pill.is-on { background: var(--f-accent); color: var(--f-on-accent); border-color: var(--f-accent); }
@media (max-width: 560px) { .f-matrix-scroll { display: none; } .f-matrix-stack { display: block; } }

/* Signature */
.f-sig { max-width: 520px; }
.f-sig-pad { display: block; width: 100%; height: 170px; border-radius: var(--f-radius); border: 1px dashed var(--f-line); background: color-mix(in srgb, var(--f-surface) 80%, transparent); touch-action: none; cursor: crosshair; color: var(--f-ink); }
.f-sig-pad:focus-visible { box-shadow: 0 0 0 3px var(--f-accent-soft); }
.f-sig-base { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12.5px; color: var(--f-muted); }

/* Statement */
.f-statement-title { font-family: var(--f-title-font); font-weight: var(--f-title-weight); letter-spacing: var(--f-title-track); font-size: 28px; line-height: 1.15; margin: 0 0 8px; }
.f-statement p { margin: 0; color: var(--f-muted); font-size: 16px; white-space: pre-line; }

/* Focus mode */
.fr-focus { min-height: 100vh; min-height: 100dvh; display: grid; align-items: center; padding: 72px 20px 110px; }
.fr-preview .fr-focus { min-height: 100%; }
.fr-welcome, .fr-card { width: 100%; max-width: 680px; margin: 0 auto; }
.fr-welcome { animation: rise .6s var(--ease-out); }
.fr-start { display: flex; align-items: center; gap: 16px; margin-top: 36px; }
.fr-card .q-title { font-family: var(--f-title-font); font-weight: var(--f-title-weight); letter-spacing: var(--f-title-track); font-size: clamp(24px, 3.4vw, 34px); line-height: 1.18; margin-bottom: 10px; }
.fr-card .q-help { font-size: 16px; }
.fr-card .f-input { font-size: clamp(20px, 2.6vw, 26px); padding: 12px 0 14px; }
.fr-card .q > :is(.f-choices, .f-yesno, .f-rating, .f-scale-wrap, .f-rank, .f-matrix, .f-sig), .fr-card .q-title + .f-input, .fr-card .q-help + .f-input { margin-top: 26px; }
.fr-card .f-choice { min-height: 54px; font-size: 17px; }
.fr-card .q-statement .f-statement-title { font-size: clamp(30px, 4.4vw, 46px); }
.fr-qnum { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 14px; color: var(--f-accent); font: 600 14px/1 var(--mono); }
.fr-ok { display: flex; align-items: center; gap: 14px; margin-top: 30px; animation: fade-in .3s var(--ease); }
.in-up { animation: card-up .52s var(--ease-out); }
.in-down { animation: card-down .52s var(--ease-out); }
@keyframes card-up { from { opacity: 0; transform: translateY(36px); } to { opacity: 1; transform: none; } }
@keyframes card-down { from { opacity: 0; transform: translateY(-36px); } to { opacity: 1; transform: none; } }
.fr-stepper { position: fixed; right: 20px; bottom: 20px; display: flex; gap: 1px; border-radius: var(--f-radius); overflow: hidden; box-shadow: 0 10px 24px -12px var(--f-accent); z-index: 10; }
.fr-preview .fr-stepper { position: absolute; }
.fr-step { width: 44px; height: 40px; display: grid; place-items: center; border: 0; background: var(--f-accent); color: var(--f-on-accent); }
.fr-step:hover:not([disabled]) { filter: brightness(1.1); }
.fr-step[disabled] { opacity: .45; }

/* Done */
.fr-done { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 40px 20px 110px; }
.fr-preview .fr-done { min-height: 100%; }
.fr-done-card { max-width: 560px; text-align: center; display: grid; justify-items: center; gap: 4px; animation: rise .6s var(--ease-out); }
.fr-done-card .fr-desc { margin: 0 auto 24px; }
.fr-done-mark { width: 74px; height: 74px; margin-bottom: 22px; }
.fr-done-mark svg { width: 100%; height: 100%; fill: none; stroke: var(--f-accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.fr-done-mark circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .7s var(--ease-out) .05s forwards; opacity: .35; }
.fr-done-mark path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s var(--ease-out) .55s forwards; stroke-width: 3; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.fr-score { display: grid; justify-items: center; gap: 12px; margin: 8px 0 24px; }
.fr-score p { margin: 0; color: var(--f-muted); font-weight: 550; }
.fr-score-ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--f-accent) calc(var(--p) * 1%), var(--f-line) 0); animation: fade-in .6s var(--ease); }
.fr-score-ring span { width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; background: var(--f-surface); font: 400 44px/1 var(--f-title-font); letter-spacing: -0.03em; }
.fr-score-ring small { font-size: 20px; color: var(--f-muted); }

/* Badge */
.fr-made { position: fixed; left: 16px; bottom: 16px; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border-radius: 99px; background: var(--f-surface); border: 1px solid var(--f-line); color: var(--f-muted); font-size: 12px; text-decoration: none; box-shadow: 0 6px 18px -10px rgba(0,0,0,.3); z-index: 9; transition: color .2s, transform .2s var(--ease); backdrop-filter: blur(10px); }
.fr-made:hover { color: var(--f-ink); transform: translateY(-1px); }
.fr-made strong { color: var(--f-ink); font-weight: 600; }
.fr-made-mark { width: 16px; height: 16px; border-radius: 5px; background: var(--signature); }

@media (max-width: 640px) {
  .fr-block { padding: 20px 18px; }
  .fr-classic { padding-top: 36px; }
  .fr-yesno, .f-yesno { grid-template-columns: 1fr 1fr; }
  .f-scale { gap: 4px; }
  .f-nps { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .f-scale-btn { height: 46px; }
  .fr-made { left: 50%; transform: translateX(-50%); bottom: 12px; }
  .fr-made:hover { transform: translateX(-50%); }
  .fr-stepper { bottom: 60px; }
}
.fr .f-input:focus-visible, .fr .f-other-input:focus-visible { border-radius: 0; }
.fr .f-input:focus-visible { box-shadow: 0 1.5px 0 0 var(--f-accent); }
.fr .f-other-input:focus-visible { box-shadow: none; }
@media (hover: none) and (pointer: coarse) { .f-kbd-hint, .fr-hint, .fr-key-hint { display: none; } .f-key { display: none; } }
