/* Built on the Eeva design system. Every colour, size, radius, shadow and timing below is an Eeva token
   from eeva/tokens.css (generated from the design system, which stays the source of truth).
   Where Eeva has no component for something this survey needs (rating scale, voice orb, profile table,
   guided tour), the part is composed here from Eeva tokens and the closest Eeva pattern, named in a comment. */
@import url("eeva/tokens.css");

:root {
  /* names the admin and older rules still use, pointed at Eeva tokens */
  --bg: var(--surface-sunken);
  --card: var(--surface-default);
  --ink: var(--text-primary);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --line: var(--border-divider);
  --accent: var(--action-accent);
  --accent-soft: var(--action-hover-tint);
  --peach: var(--status-required-edge);
  --brown: var(--status-required);
  --error: var(--status-danger);
  --ok: var(--status-success);
  --serif: var(--font-display);
  --sans: var(--font-ui);
  --chat-w: 400px;
  --level: 0;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  color: var(--text-primary); font: 400 15px/24px var(--font-ui); min-height: 100vh;
  /* platform page ground: canvas with the wash over the top 400px */
  background: var(--bg-wash) top / 100% var(--bg-wash-height) no-repeat fixed, var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
}
/* display type is for titles only */
h1, h2, h3 { font-family: var(--font-display); font-weight: 300; color: var(--text-primary); margin: 0 0 var(--space-12); }
h1 { font-size: 32px; line-height: 38px; letter-spacing: -0.03em; }   /* detail-title */
h2 { font-size: 28px; line-height: 34px; }                            /* doc-title */
h3 { font-size: 17px; line-height: 24px; font-family: var(--font-ui); font-weight: 600; }  /* modal-title */
p { margin: 0 0 var(--space-12); }
a { color: var(--text-accent); text-underline-offset: 3px; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* header: the flow header, a blurred backing that fades into the page */
.topbar { position: sticky; top: 0; z-index: var(--z-sticky); background: var(--header-backing); -webkit-backdrop-filter: blur(var(--header-backing-blur)); backdrop-filter: blur(var(--header-backing-blur)); color: var(--text-primary); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); padding: var(--space-12) var(--space-24); min-height: 60px; }
.brand { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text-primary); }
.top-actions { display: flex; gap: var(--space-8); flex-wrap: wrap; justify-content: flex-end; }
.progress { height: 2px; background: var(--border-divider); }
.progress-fill { height: 100%; width: 0; background: var(--action-primary); transition: width var(--dur-slow) var(--ease-standard); }
/* message bar, info tone: one line of status on a sand band */
.test-banner, .notice { background: var(--surface-band); color: var(--text-primary); font-size: 13px; line-height: 18px; padding: var(--space-8) var(--space-20); text-align: center; }
.notice { border-radius: var(--radius-md); text-align: left; margin-bottom: var(--space-16); padding: var(--space-12) var(--space-16); }

/* Button: pill, md 40px, control type. primary = ink (one per view), ghost = secondary, link-btn = text */
.btn { font: 500 14px/20px var(--font-ui); height: var(--size-md); padding: 0 var(--space-20); border-radius: var(--radius-pill); cursor: pointer; border: 0; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8); white-space: nowrap; transition: background-color var(--dur-instant) var(--ease-standard), box-shadow var(--dur-instant) var(--ease-standard); }
.btn.primary { background: var(--action-primary); color: var(--text-inverse); }
.btn.primary:hover { background: var(--action-primary-hover); }
.btn.primary:active { background: var(--action-primary-pressed); }
.btn.primary:disabled { opacity: .4; cursor: default; }
.btn.ghost { background: var(--surface-default); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--action-secondary-border); }
.btn.ghost:hover { background: linear-gradient(var(--action-hover-tint), var(--action-hover-tint)), var(--surface-default); }
.btn.ghost:active { background: linear-gradient(var(--action-pressed-tint), var(--action-pressed-tint)), var(--surface-default); }
.btn.ghost:disabled { opacity: .4; cursor: default; }
.btn.ghost:focus-visible, .btn.primary:focus-visible { box-shadow: var(--focus-ring); }
.topbar .btn { height: var(--size-sm); font-size: 13px; padding: 0 var(--space-16); }
/* icon-only button: a 32px circle */
.icon-btn { width: var(--size-sm); height: var(--size-sm); flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-pill); background: none; border: 0; color: var(--text-secondary); cursor: pointer; font-size: 20px; line-height: 1; padding: 0; transition: background-color var(--dur-instant) var(--ease-standard); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--action-icon-hover-tint); color: var(--text-primary); }
.link-btn { background: none; border: 0; padding: 0; font: 500 13px/20px var(--font-ui); color: var(--text-secondary); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; border-radius: var(--radius-xs); }
.link-btn:hover { color: var(--text-primary); }

/* layout */
.main { max-width: var(--layout-chat-narrow-panel); margin: 0 auto; padding: var(--space-32) var(--space-20) 80px; }
body.chat-open .layout, body.chat-open .test-banner { padding-right: var(--chat-w); }
/* a white surface on the canvas: 1px ink edge plus a soft lift, never a grey border */
.card { background: var(--surface-default); border-radius: var(--radius-2xl); box-shadow: var(--elevation-tile); padding: var(--space-40); margin-bottom: var(--space-16); animation: rise var(--dur-base) var(--ease-standard) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.section-label { font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); margin-bottom: var(--space-12); }  /* label-caps */
.actions { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-16); gap: var(--space-12); }
.actions .spacer { flex: 1; }

/* guided tour: Eeva has no tour, so the pop-up is the Modal (radius, lift, title and body type) over the scrim */
.tour-shield { position: fixed; inset: 0; z-index: var(--z-modal); }
.tour-hole { position: fixed; z-index: 41; border-radius: var(--radius-lg); box-shadow: 0 0 0 9999px var(--overlay-scrim), 0 0 0 2px var(--surface-default); pointer-events: none; transition: top var(--dur-base) var(--ease-standard), left var(--dur-base) var(--ease-standard), width var(--dur-base) var(--ease-standard), height var(--dur-base) var(--ease-standard); }
.tour-pop { position: fixed; z-index: 42; width: 340px; max-width: calc(100vw - 16px); background: var(--surface-default); border-radius: var(--radius-xl); box-shadow: var(--elevation-modal); padding: var(--space-20); animation: pop var(--dur-base) var(--ease-standard) both; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.tour-title { font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); margin-bottom: var(--space-8); }
.tour-text { font-size: 14px; line-height: 21px; color: var(--text-primary); }
.tour-actions { display: flex; align-items: center; gap: var(--space-8); margin-top: var(--space-16); }
.tour-actions .spacer { flex: 1; }
.tour-btn { font: 500 13px/20px var(--font-ui); height: var(--size-sm); padding: 0 var(--space-16); border: 0; border-radius: var(--radius-pill); background: var(--surface-default); box-shadow: inset 0 0 0 1px var(--action-secondary-border); color: var(--text-primary); cursor: pointer; }
.tour-btn:hover { background: linear-gradient(var(--action-hover-tint), var(--action-hover-tint)), var(--surface-default); }
.tour-btn.primary { background: var(--action-primary); color: var(--text-inverse); box-shadow: none; }
.tour-btn.primary:hover { background: var(--action-primary-hover); }

/* questions */
.question { border: 0; padding: 0; margin: 0 0 var(--space-32); min-width: 0; }
.question:last-of-type { margin-bottom: var(--space-8); }
.question legend, .q-text { font: 600 17px/24px var(--font-ui); color: var(--text-primary); padding: 0; margin-bottom: var(--space-8); }
.help { color: var(--text-secondary); font-size: 13px; line-height: 20px; margin-bottom: var(--space-12); }
.error { color: var(--status-danger); font-size: 13px; line-height: 20px; margin-top: var(--space-8); font-weight: 600; }
/* answer choices: the checklist row. Rows 2px apart, the whole row is the target, a chosen row takes the tinted fill */
.option { display: flex; align-items: flex-start; gap: var(--space-12); padding: 10px var(--space-12); border-radius: var(--radius-md); margin-top: 2px; cursor: pointer; background: transparent; font-size: 15px; line-height: 24px; transition: background-color var(--dur-instant) var(--ease-standard); }
.option:hover { background: var(--action-hover-tint); }
.option input { margin: 4px 0 0; accent-color: var(--action-primary); flex: none; width: 16px; height: 16px; }
.option.selected { background: var(--question-option-active); }
.option.disabled { opacity: .4; cursor: default; }
.option.disabled:hover { background: transparent; }
.option:focus-within { box-shadow: var(--focus-ring); }
.option input:focus-visible { box-shadow: none; }
.option .sub { display: block; color: var(--text-secondary); font-size: 13px; line-height: 20px; }
.option strong { font-weight: 600; color: var(--text-primary); }
/* fields: inset rings, radius-md, 32px */
input[type=number], input[type=text], input[type=password], textarea { font: 400 13px/20px var(--font-ui); border: 0; border-radius: var(--radius-md); padding: 6px 10px; background: var(--surface-default); color: var(--text-primary); box-shadow: var(--field-rest); transition: box-shadow var(--dur-instant) var(--ease-standard); }
input[type=number], input[type=text], input[type=password] { height: var(--size-sm); }
input[type=number]:hover, input[type=text]:hover, textarea:hover { box-shadow: var(--field-hover); }
input[type=number]:focus, input[type=text]:focus, input[type=password]:focus, textarea:focus { box-shadow: var(--field-editing); }
::placeholder { color: var(--text-tertiary); }
input[type=number] { width: 110px; }
textarea { width: 100%; resize: vertical; font-size: 15px; line-height: 24px; padding: var(--space-12); }
.num-row { display: flex; align-items: center; gap: var(--space-8); margin-top: var(--space-12); }
.unit { color: var(--text-secondary); font-size: 13px; }
.sum-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); padding: var(--space-8) 0; border-bottom: 1px solid var(--border-divider); }
.sum-row .num-row { margin: 0; flex: none; }
.sum-total { display: flex; justify-content: space-between; padding: var(--space-12) 0 0; font-weight: 600; }
.sum-total.ok { color: var(--status-success); }

/* rating scale: Eeva has none, so each point is a field-ringed tile and the chosen point takes the primary fill */
.scale { margin-top: var(--space-12); }
.scale-points { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--space-8); }
.scale-points label { display: flex; align-items: center; justify-content: center; height: var(--size-md); border-radius: var(--radius-md); cursor: pointer; font: 600 14px/20px var(--font-ui); background: var(--surface-default); color: var(--text-primary); box-shadow: var(--field-rest); transition: background-color var(--dur-instant) var(--ease-standard), box-shadow var(--dur-instant) var(--ease-standard); }
.scale-points label:hover { box-shadow: var(--field-hover); background: var(--surface-sunken); }
.scale-points input { position: absolute; opacity: 0; pointer-events: none; }
.scale-points label.selected { background: var(--action-primary); color: var(--text-inverse); box-shadow: none; }
.scale-points label:focus-within { box-shadow: var(--focus-ring); }
.scale-ends { display: flex; justify-content: space-between; color: var(--text-secondary); font-size: 12px; line-height: 16px; margin-top: var(--space-8); gap: var(--space-12); }
.scale-ends span:last-child { text-align: right; }
.grid-item { padding: var(--space-16) 0; border-top: 1px solid var(--border-divider); }
.grid-item:first-of-type { border-top: 0; padding-top: var(--space-4); }
.grid-item .stmt { font-weight: 600; color: var(--text-primary); }

/* stimulus: a recessed box */
.message-card { background: var(--surface-sunken); border-radius: var(--radius-xl); box-shadow: var(--elevation-edge); padding: var(--space-24); margin-bottom: var(--space-28); }
.message-card .headline { font-family: var(--font-display); font-weight: 300; font-size: 28px; line-height: 34px; color: var(--text-primary); margin-bottom: var(--space-8); }
.message-card .support { color: var(--text-primary); }
/* product profile table: a small-caps header band over hairline rows, as the agent message table */
.table-wrap { overflow-x: auto; margin: var(--space-4) 0 var(--space-12); border-radius: var(--radius-lg); box-shadow: var(--elevation-edge); background: var(--surface-default); }
table.profile { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 20px; min-width: 560px; background: var(--surface-default); }
table.profile th, table.profile td { border: 0; border-bottom: 1px solid var(--border-divider); padding: 10px var(--space-12); text-align: left; vertical-align: top; }
table.profile tbody tr:last-child th, table.profile tbody tr:last-child td { border-bottom: 0; }
table.profile thead th { background: var(--surface-band); color: var(--text-secondary); font-size: 11px; line-height: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--table-head-rule); }
table.profile thead th.px { color: var(--text-primary); }
table.profile td.px, table.profile tbody td:nth-child(2) { background: var(--selected-row-bg); }
table.profile tr.sec th { background: var(--surface-sunken); text-transform: uppercase; font-size: 11px; line-height: 14px; letter-spacing: .06em; color: var(--text-secondary); }
table.profile tbody th { font-weight: 600; width: 22%; color: var(--text-primary); }
.footnote { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.ref-profile { background: var(--surface-sunken); border-radius: var(--radius-xl); box-shadow: var(--elevation-edge); margin-bottom: var(--space-28); text-align: left; }
.ref-profile summary { cursor: pointer; padding: var(--space-12) var(--space-16); font: 500 14px/20px var(--font-ui); color: var(--text-primary); border-radius: var(--radius-xl); }
.ref-profile .ref-body { padding: 0 var(--space-16) var(--space-8); }
.ref-profile table.profile th, .ref-profile table.profile td { padding: 6px 10px; }

/* the AI conversation in the middle of the page (follow-ups and conversational questions) */
.convo { text-align: center; padding-top: var(--space-28); }
.convo .section-label { text-align: left; }
/* voice orb: Eeva has no voice control. Ink and still at rest, ember while it needs the person (listening),
   following the rule for the agent's mark: ember when active, ink when done. */
.orb-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--space-12); margin: var(--space-16) 0 var(--space-24); }
.orb { position: relative; width: 132px; height: 132px; display: flex; align-items: center; justify-content: center; }
.orb::before, .orb::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--action-accent); opacity: 0; transition: transform 80ms linear, opacity var(--dur-base) var(--ease-standard); }
.orb-core { position: relative; z-index: 1; width: 84px; height: 84px; border-radius: 50%; background: var(--action-primary); transition: transform 80ms linear, background-color var(--dur-base) var(--ease-standard); }
body[data-voice=listening] .orb-core { background: var(--action-accent); transform: scale(calc(1 + var(--level) * .35)); }
body[data-voice=listening] .orb::before { opacity: .28; transform: scale(calc(.72 + var(--level) * .5)); }
body[data-voice=listening] .orb::after { opacity: .14; transform: scale(calc(.8 + var(--level) * .75)); }
body[data-voice=speaking] .orb-core { animation: speak var(--dur-pulse) ease-in-out infinite; }
body[data-voice=thinking] .orb-core { background: var(--sand-300); animation: think var(--dur-pulse) ease-in-out infinite; }
@keyframes speak { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.14); } 60% { transform: scale(.96); } }
@keyframes think { 0%, 80%, 100% { opacity: .35; } 40% { opacity: 1; } }
.voice-label { font-size: 12px; line-height: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); min-height: 16px; }
body[data-voice=listening] .voice-label { color: var(--text-accent); }
/* the agent's words: never in a bubble. Here they are the title of the screen. */
.convo-question { font-family: var(--font-display); font-weight: 300; font-size: 28px; line-height: 34px; color: var(--text-primary); max-width: var(--layout-chat-wide-panel); margin: 0 auto var(--space-20); }
/* the person's words as they speak: their message bubble */
.convo-live { max-width: 620px; margin: 0 auto; min-height: 72px; padding: var(--space-12) var(--space-16); border-radius: var(--radius-bubble); background: var(--surface-bubble); text-align: left; font-size: 15px; line-height: 24px; color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; }
.convo-live:empty { background: var(--surface-sunken); box-shadow: var(--elevation-edge); }
.convo-live:empty::before { content: attr(data-hint); color: var(--text-tertiary); }
.convo-note { font-size: 13px; line-height: 20px; color: var(--text-secondary); max-width: 620px; margin: var(--space-12) auto 0; }
/* typing instead: the composer. White, radius 16, the composer lift and no border */
.convo-type { max-width: 620px; margin: 0 auto; text-align: right; }
.convo-type textarea, .chat-form textarea { border-radius: var(--radius-2xl); box-shadow: var(--elevation-composer); padding: var(--space-16); resize: none; margin-bottom: var(--space-12); }
.convo-type textarea:hover, .chat-form textarea:hover { box-shadow: var(--elevation-composer); }
.convo-type textarea:focus, .chat-form textarea:focus { box-shadow: var(--elevation-composer-focus); }
.convo-foot { display: flex; align-items: center; justify-content: center; gap: var(--space-24); margin-top: var(--space-24); flex-wrap: wrap; }
/* sound and microphone check */
.check h1 { margin-bottom: var(--space-8); }
.check .check-text { max-width: 560px; margin: 0 auto var(--space-16); }
.check-tips { max-width: 560px; margin: var(--space-16) auto 0; padding: var(--space-12) var(--space-16); text-align: left; font-size: 13px; line-height: 18px; background: var(--surface-band); border-radius: var(--radius-md); }
.check-tips p { margin: 0 0 var(--space-4); }
.check-tips p:first-child { font-weight: 600; color: var(--text-primary); }
.check-tips p:last-child { margin-bottom: 0; }

/* "Ask a question" panel: the chat ground, the agent in plain text, the person in a bubble, one composer at the foot */
.chat { position: fixed; top: 0; right: 0; bottom: 0; width: var(--chat-w); z-index: var(--z-overlay); background: var(--bg-chat); box-shadow: var(--elevation-panel); display: flex; flex-direction: column; animation: drawer var(--dur-slow) var(--ease-enter) both; }
@keyframes drawer { from { opacity: 0; transform: translateX(16px); } }
.chat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-8); padding: var(--space-20) var(--space-20) var(--space-16); border-bottom: 1px solid var(--border-divider); }
.chat-title { font: 600 17px/24px var(--font-ui); color: var(--text-primary); }
.chat-sub { font-size: 12px; line-height: 16px; color: var(--text-secondary); margin-top: 2px; }
.chat-log { flex: 1; overflow-y: auto; padding: var(--space-20); display: flex; flex-direction: column; gap: var(--space-20); }
.bubble { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 24px; }
.bubble.agent { align-self: flex-start; color: var(--text-primary); }
.bubble.respondent { max-width: 78%; padding: var(--space-8) var(--space-16); background: var(--surface-bubble); border-radius: var(--radius-bubble); color: var(--text-primary); align-self: flex-end; }
.bubble.typing { color: var(--text-tertiary); letter-spacing: 3px; animation: think var(--dur-pulse) ease-in-out infinite; }
.chat-voice { display: flex; align-items: center; gap: var(--space-12); padding: var(--space-8) var(--space-20); }
.chat-voice .voice-label { flex: 1; min-height: 0; }
.bars { display: flex; align-items: center; gap: 3px; height: 26px; }
.bars i { display: block; width: 4px; height: 6px; background: var(--sand-300); border-radius: 2px; transition: height 80ms linear; }
body[data-voice=listening] .bars i { background: var(--action-accent); }
body[data-voice=listening] .bars i:nth-child(1), body[data-voice=listening] .bars i:nth-child(5) { height: calc(6px + var(--level) * 9px); }
body[data-voice=listening] .bars i:nth-child(2), body[data-voice=listening] .bars i:nth-child(4) { height: calc(6px + var(--level) * 16px); }
body[data-voice=listening] .bars i:nth-child(3) { height: calc(6px + var(--level) * 20px); }
.chat-form { padding: var(--space-8) var(--space-20) var(--space-20); background: var(--composer-backing); }
.chat-form textarea { margin-bottom: var(--space-8); }
.chat-form-row { display: flex; justify-content: flex-end; }

/* large profile pop-up: the modal surface over the scrim */
.modal { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--overlay-scrim); -webkit-backdrop-filter: blur(var(--overlay-scrim-blur)); backdrop-filter: blur(var(--overlay-scrim-blur)); display: flex; align-items: center; justify-content: center; padding: var(--space-20); }
.modal-card { background: var(--surface-default); border-radius: var(--radius-2xl); box-shadow: var(--elevation-modal); max-width: 1240px; width: 100%; max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; animation: pop var(--dur-base) var(--ease-standard) both; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: var(--space-16) var(--space-24); border-bottom: 1px solid var(--border-divider); }
.modal-head h2 { margin: 0; font: 600 17px/24px var(--font-ui); }
.modal-body { padding: var(--space-20) var(--space-24) var(--space-24); overflow-y: auto; }
.modal-body table.profile { font-size: 15px; line-height: 24px; }
.modal-body table.profile th, .modal-body table.profile td { padding: var(--space-12) var(--space-16); }
.modal-body table.profile thead th, .modal-body table.profile tr.sec th { font-size: 12px; line-height: 16px; }

@media (max-width: 900px) {
  body.chat-open .layout { padding-right: 0; }
  body.chat-open .test-banner { padding-right: var(--space-20); }
  .chat { width: 100%; }
  .card { padding: var(--space-24) var(--space-16); }
  .main { padding: var(--space-16) var(--space-12) 60px; }
  .topbar-inner { padding: var(--space-8) var(--space-12); }
  h1 { font-size: 28px; line-height: 34px; }
  .convo-question { font-size: 24px; line-height: 30px; }
  .orb { width: 104px; height: 104px; } .orb-core { width: 66px; height: 66px; }
  .scale-points { gap: var(--space-4); }
  .sum-row { flex-direction: column; align-items: flex-start; gap: var(--space-8); }
}
@media (prefers-reduced-motion: reduce) {
  body[data-voice=speaking] .orb-core, body[data-voice=thinking] .orb-core, .bubble.typing { animation: none; }
  .card, .tour-pop, .modal-card, .chat { animation: fade var(--dur-fast) linear both; }
  @keyframes fade { from { opacity: 0; } }
}
