:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #edf3ef;
  --text: #16231d;
  --muted: #627169;
  --border: #d9e2dc;
  --primary: #176b4d;
  --primary-dark: #0f523b;
  --primary-soft: #dff1e9;
  --accent: #d98f39;
  --danger: #a33d39;
  --danger-soft: #fbe9e7;
  --success: #176b4d;
  --shadow: 0 18px 50px rgba(30, 52, 42, .08);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; padding: 10px 16px; background: var(--text); color: white; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.topbar { height: 76px; padding: 0 clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--primary); color: white; font-weight: 800; letter-spacing: -.04em; }
.brand strong, .brand small { display: block; line-height: 1.15; }
.brand small { color: var(--muted); margin-top: 3px; }
.user-controls { display: flex; gap: 16px; align-items: center; }
main { width: min(1440px, 100%); margin: 0 auto; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 4rem); line-height: 1.05; letter-spacing: -.045em; }
h2 { font-size: 1.35rem; letter-spacing: -.02em; }
.muted, .fine-print { color: var(--muted); }
.eyebrow { display: inline-block; margin-bottom: 8px; color: var(--primary); font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-layout { min-height: calc(100vh - 76px); padding: clamp(44px, 8vw, 110px) clamp(20px, 7vw, 100px); display: grid; grid-template-columns: 1.2fr minmax(320px, 460px); align-items: center; gap: clamp(40px, 9vw, 140px); }
.auth-copy { max-width: 680px; }
.auth-copy p { max-width: 600px; font-size: 1.12rem; color: var(--muted); }
.feature-list { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; list-style: none; }
.feature-list li { padding: 9px 13px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; font-size: .88rem; }
.auth-card { padding: 34px; }
.auth-card h2 { font-size: 2rem; margin-bottom: 28px; }
label { display: grid; gap: 7px; margin-bottom: 18px; font-size: .9rem; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #cbd7d0; border-radius: 11px; background: #fff; color: var(--text); padding: 12px 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(23,107,77,.12); }
textarea { resize: vertical; }
.button { min-height: 42px; border: 1px solid transparent; border-radius: 11px; padding: 10px 17px; font-weight: 800; transition: transform .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-dark); }
.button-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.button-danger { background: var(--danger-soft); color: var(--danger); }
.button-block { width: 100%; }
.icon-button { border: 1px solid var(--border); background: var(--surface); width: 38px; height: 38px; border-radius: 10px; font-size: 1.25rem; }
.form-message { padding: 11px 13px; border-radius: 10px; background: var(--surface-soft); }
.form-message.error { color: var(--danger); background: var(--danger-soft); }
.app-shell { padding: 52px clamp(20px, 5vw, 72px) 80px; }
.page-heading, .panel-heading, .dialog-heading, .completion-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.page-heading h1 { margin-bottom: 8px; }
.page-heading p { color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 30px 0; }
.metric { padding: 20px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); }
.metric span { display: block; color: var(--muted); font-size: .82rem; }
.metric strong { display: block; margin-top: 5px; font-size: 1.9rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(300px, .78fr) minmax(480px, 1.5fr); gap: 22px; align-items: start; }
.list-panel, .detail-panel { min-height: 520px; padding: 24px; }
.evaluation-list { display: grid; gap: 10px; margin-top: 20px; }
.evaluation-item { width: 100%; text-align: left; border: 1px solid var(--border); background: #fff; border-radius: 13px; padding: 15px; }
.evaluation-item:hover, .evaluation-item.active { border-color: var(--primary); background: var(--primary-soft); }
.evaluation-item strong, .evaluation-item span { display: block; }
.evaluation-item span { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.item-status { display: flex !important; justify-content: space-between; margin-top: 12px !important; }
.badge { display: inline-flex; align-items: center; width: fit-content; padding: 5px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: .75rem; font-weight: 800; }
.badge.success { background: var(--primary-soft); color: var(--primary); }
.badge.warning { background: #fff0da; color: #865317; }
.empty-state, .message-card, .loading-card { text-align: center; display: grid; justify-items: center; align-content: center; min-height: 420px; padding: 40px; }
.empty-icon, .message-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; color: var(--primary); background: var(--primary-soft); font-size: 1.5rem; font-weight: 900; margin-bottom: 18px; }
.detail-header { padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.detail-header h2 { margin-bottom: 5px; }
.detail-section { margin-top: 26px; }
.detail-section > h3 { margin-bottom: 12px; font-size: 1rem; }
.invite-card { padding: 15px; border: 1px solid var(--border); border-radius: 13px; margin-bottom: 10px; }
.invite-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.link-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.link-row input { margin: 0; min-width: 0; font-size: .82rem; }
.invite-actions { display: flex; gap: 8px; margin-top: 9px; }
.score-card { border-left: 4px solid var(--primary); padding: 14px 15px; background: var(--surface-soft); border-radius: 0 12px 12px 0; margin-bottom: 12px; }
.score-card h4 { margin: 0 0 8px; }
.score-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.score-line { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.dialog { width: min(680px, calc(100vw - 28px)); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 30px 100px rgba(15, 41, 29, .26); }
.dialog::backdrop { background: rgba(18,35,27,.45); backdrop-filter: blur(3px); }
.dialog form { padding: 28px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 16px; }
.field-wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin: 4px 0 16px; }
legend { font-weight: 800; font-size: .88rem; }
.check { display: inline-flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; margin: 6px 20px 6px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.respondent-body { background: #f7f8f5; }
.respondent-topbar { position: static; }
.save-status { font-size: .8rem; color: var(--muted); }
.progress-track { position: sticky; top: 0; z-index: 19; height: 5px; background: #dfe7e1; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s; }
.respondent-shell { width: min(900px, calc(100% - 32px)); padding: 44px 0 90px; }
.respondent-intro { text-align: center; max-width: 720px; margin: 0 auto 30px; }
.respondent-intro h1 { font-size: clamp(2.2rem, 7vw, 4.3rem); }
.respondent-intro > p { color: var(--muted); font-size: 1.05rem; }
.privacy-note { max-width: 680px; padding: 13px 16px; margin: 22px auto 0; border-radius: 12px; background: var(--primary-soft); color: var(--primary-dark); text-align: left; font-size: .88rem; }
.respondent-meta, .submit-panel { padding: 24px; margin-bottom: 20px; }
.instrument-card { padding: 0; overflow: hidden; margin: 20px 0; }
.instrument-heading { padding: 24px; background: var(--surface-soft); border-bottom: 1px solid var(--border); }
.instrument-heading h2 { margin-bottom: 6px; }
.instrument-heading p { margin: 0; color: var(--muted); font-size: .9rem; }
.section-heading { padding: 22px 24px 8px; }
.question { padding: 22px 24px; border-top: 1px solid var(--border); }
.question-text { display: flex; gap: 12px; margin-bottom: 15px; font-weight: 700; }
.question-number { flex: 0 0 auto; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-soft); color: var(--primary); font-size: .76rem; }
.choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; }
.choice { position: relative; margin: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { min-height: 54px; padding: 9px 7px; display: grid; place-items: center; text-align: center; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--muted); font-size: .78rem; font-weight: 700; cursor: pointer; }
.choice input:focus-visible + span { outline: 3px solid rgba(23,107,77,.2); }
.choice input:checked + span { border-color: var(--primary); background: var(--primary); color: #fff; }
.question.answered { background: #fbfdfb; }
.submit-panel { position: sticky; bottom: 12px; z-index: 10; box-shadow: 0 18px 60px rgba(27, 55, 42, .18); }
.completion-row p { margin: 3px 0 0; color: var(--muted); font-size: .82rem; }
.success-card { margin-top: 40px; }
.receipt { margin: 20px 0; padding: 13px 18px; background: var(--surface-soft); border-radius: 12px; }
.receipt span, .receipt code { display: block; }
.receipt span { color: var(--muted); font-size: .75rem; }
.receipt code { margin-top: 4px; overflow-wrap: anywhere; }
.spinner { width: 38px; height: 38px; border: 4px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin-bottom: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 900px) {
  .auth-layout, .dashboard-grid { grid-template-columns: 1fr; }
  .auth-layout { align-content: center; }
  .auth-copy { text-align: center; margin: 0 auto; }
  .feature-list { justify-content: center; }
  .detail-panel { min-height: 400px; }
}
@media (max-width: 640px) {
  .topbar { height: 66px; padding: 0 16px; }
  .user-controls .muted { display: none; }
  .app-shell { padding: 32px 16px 60px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 2.3rem; }
  .metrics { grid-template-columns: 1fr; gap: 9px; }
  .metric { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; }
  .metric strong { font-size: 1.35rem; }
  .list-panel, .detail-panel { padding: 17px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .respondent-shell { width: min(100% - 20px, 900px); padding-top: 30px; }
  .respondent-meta, .submit-panel { padding: 17px; }
  .instrument-heading, .question { padding: 18px 15px; }
  .section-heading { padding: 20px 15px 6px; }
  .choice-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .completion-row { align-items: stretch; flex-direction: column; }
  .completion-row .button { width: 100%; }
  .submit-panel { position: static; }
  .score-grid { grid-template-columns: 1fr; }
}
@media print {
  .topbar, .metrics, .list-panel, .page-heading .button, .invite-actions { display: none !important; }
  body, .panel { background: white; box-shadow: none; }
  .dashboard-grid { display: block; }
  .detail-panel { border: 0; }
}
