:root {
  --obsidian: #070709;
  --paper: #ffffff;
  --cloud: #f5f5f5;
  --sky-tint: #d7e6f5;
  --charcoal: #60606c;
  --slate: #8b8b8b;
  --hairline: #bebecc;
  --line: rgba(0,0,0,.09);
  --blue: #2597d0;
  --red: #c4322b;
  --sky: linear-gradient(180deg, #779bc1 0%, #9abfda 58%, #cbdcec 100%);
  --shadow-card: rgba(16,55,132,.05) 0 1px 2px, rgba(16,55,132,.07) 0 14px 30px -10px;
  --shadow-btn: rgba(36,36,40,.1) 0 1px 2px, rgba(36,36,40,.09) 0 3px 3px, rgba(36,36,40,.05) 0 6px 4px;
  --display: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--cloud); color: var(--obsidian); font: 400 16px/1.5 var(--display); letter-spacing: -.01em; -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--charcoal); }
.small { font-size: 13.5px; }
.center { text-align: center; }
.pad { padding: 64px 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* nav */
header { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; letter-spacing: -.03em; text-decoration: none; }
.ghost-logo { width: 20px; height: 24px; }
.nav .right { margin-left: auto; display: flex; align-items: center; gap: 12px; font: 500 14px var(--ui); }

/* buttons + inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 500 14.5px var(--display); letter-spacing: -.01em; text-decoration: none; padding: 10px 20px; border-radius: 100px; border: 1px solid transparent; cursor: pointer; background: none; color: var(--obsidian); white-space: nowrap; }
.btn.primary { background: var(--obsidian); color: #fff; box-shadow: var(--shadow-btn); }
.btn.outline { border-color: var(--obsidian); }
.btn.ghost:hover, .icon:hover { background: rgba(0,0,0,.05); }
.btn.sm { padding: 7px 14px; font-size: 13.5px; }
.btn:hover { opacity: .9; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.danger { color: var(--red); }
.icon { border: 0; background: none; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--charcoal); font-size: 16px; }
.icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

input[type=text], input[type=email], input[type=number], input[type=date], input[type=time], input[type=url], textarea, select {
  font: 400 15.5px var(--display); color: var(--obsidian); width: 100%;
  border: 0; border-bottom: 1px solid var(--hairline); background: transparent; padding: 9px 2px; outline: none; border-radius: 0;
}
textarea { resize: vertical; min-height: 40px; }
select { border: 1px solid var(--hairline); border-radius: 10px; padding: 9px 10px; background: #fff; }
input:focus, textarea:focus { border-bottom: 2px solid var(--blue); padding-bottom: 8px; }
select:focus { border-color: var(--blue); }
.boxed { border: 1px solid var(--hairline) !important; border-radius: 12px !important; padding: 11px 14px !important; background: #fff !important; }
.boxed:focus { border-color: var(--blue) !important; box-shadow: 0 0 0 3px rgba(37,151,208,.15); }

/* cards */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-card); padding: 24px 26px; margin-bottom: 14px; position: relative; }
.card.head { border-top: 8px solid var(--obsidian); }
.card.active { border-left: 4px solid var(--blue); }
h1 { font-weight: 600; font-size: clamp(28px, 4vw, 36px); letter-spacing: -.04em; line-height: 1.1; margin: 0 0 8px; }
h2 { font-weight: 600; font-size: 22px; letter-spacing: -.03em; margin: 0 0 6px; }

/* sign-in */
.hero { background: var(--sky); min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.hero .card { width: min(420px, 100%); padding: 34px; }
.hero h1 { font-size: 30px; }

/* dashboard */
.dash-top { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 40px 0 22px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; padding-bottom: 60px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow-card); text-decoration: none; display: flex; flex-direction: column; gap: 8px; min-height: 130px; cursor: pointer; }
.tile:hover { border-color: var(--hairline); }
.tile b { font-size: 16.5px; letter-spacing: -.02em; }
.tile .meta { margin-top: auto; font: 500 12.5px var(--ui); color: var(--slate); display: flex; justify-content: space-between; }
.tag { display: inline-flex; align-items: center; gap: 6px; font: 500 12px var(--ui); padding: 3px 10px; border-radius: 100px; border: 1px solid var(--line); background: #fff; color: var(--charcoal); }
.tag.live { color: #126b3c; border-color: rgba(18,107,60,.3); background: #eefaf2; }
.tag.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #1f9d57; }

/* editor */
.edbar { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 60px; z-index: 15; }
.edbar .wrap { display: flex; align-items: center; gap: 8px; min-height: 54px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.tabs { display: flex; gap: 4px; margin: 0 auto; }
.tabs button { border: 0; background: none; font: 500 14.5px var(--display); padding: 10px 14px; cursor: pointer; color: var(--charcoal); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--obsidian); border-color: var(--obsidian); }
.saved { font: 500 12.5px var(--ui); color: var(--slate); min-width: 64px; }
.editor { padding: 24px 0 120px; }
.qtitle { font-size: 17px !important; font-weight: 600; }
.q-top { display: grid; grid-template-columns: 1fr 210px; gap: 14px; align-items: start; }
@media (max-width: 640px) { .q-top { grid-template-columns: 1fr; } }
.q-foot { display: flex; align-items: center; justify-content: flex-end; gap: 4px; border-top: 1px solid var(--line); margin-top: 18px; padding-top: 10px; flex-wrap: wrap; }
.q-foot .sep { width: 1px; height: 24px; background: var(--line); margin: 0 8px; }
.handle { position: absolute; top: 0; left: 50%; transform: translateX(-50%); cursor: grab; color: var(--hairline); font-size: 15px; letter-spacing: 2px; user-select: none; -webkit-user-select: none; padding: 6px 22px 8px; touch-action: none; line-height: 1; }
.handle:hover { color: var(--charcoal); }
.card.dragging { z-index: 10; opacity: .96; box-shadow: rgba(16,55,132,.18) 0 18px 40px -8px; transition: none; }
.card.dragging .handle { cursor: grabbing; color: var(--blue); }
body.is-dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
.card.drop-before { box-shadow: 0 -4px 0 var(--blue), var(--shadow-card); }
.card.drop-after { box-shadow: 0 4px 0 var(--blue), var(--shadow-card); }
.opt { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.opt .mark { width: 18px; height: 18px; border: 2px solid var(--hairline); flex: none; }
.opt .mark.radio { border-radius: 50%; }
.opt .mark.check { border-radius: 4px; }
.opt .mark.num { border: 0; font: 500 14px var(--ui); color: var(--slate); width: auto; min-width: 18px; }
.opt input { flex: 1; }
.add-opt { color: var(--charcoal); font-size: 14.5px; cursor: pointer; background: none; border: 0; padding: 8px 0 0 28px; font-family: var(--display); }
.add-opt:hover { color: var(--obsidian); text-decoration: underline; }
.preview-line { color: var(--slate); border-bottom: 1px dotted var(--hairline); padding: 8px 2px; font-size: 14.5px; max-width: 60%; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font: 500 14px var(--ui); }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 20px; background: var(--hairline); position: relative; cursor: pointer; margin: 0; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked { background: var(--blue); }
.switch input:checked::after { left: 16px; }
.addbar { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.scale-cfg { display: grid; grid-template-columns: auto auto 1fr; gap: 10px 12px; align-items: center; max-width: 480px; margin-top: 8px; }
.scale-cfg select { width: auto; }

/* responses */
.stat { font-size: 30px; font-weight: 600; letter-spacing: -.04em; }
.table-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-card); }
table { border-collapse: collapse; width: 100%; font: 400 14px var(--ui); }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; max-width: 320px; }
th { font-weight: 600; background: #fafafa; position: sticky; top: 0; white-space: nowrap; }
td { white-space: pre-wrap; word-break: break-word; }
tr:last-child td { border-bottom: 0; }
.bars { display: grid; gap: 6px; margin-top: 10px; }
.bar { display: grid; grid-template-columns: minmax(80px, 34%) 1fr 44px; gap: 10px; align-items: center; font: 400 14px var(--ui); }
.bar .track { background: var(--cloud); border-radius: 6px; height: 10px; overflow: hidden; }
.bar .fill { background: var(--blue); height: 100%; border-radius: 6px; }
.bar .n { color: var(--charcoal); text-align: right; font-variant-numeric: tabular-nums; }

/* public form */
.fill-page { padding: 32px 0 80px; }
.fq { margin-bottom: 14px; }
.fq label.title { display: block; font-weight: 600; font-size: 16.5px; letter-spacing: -.02em; margin-bottom: 4px; }
.fq .req { color: var(--red); margin-left: 4px; }
.fq .desc { color: var(--charcoal); font-size: 14.5px; margin: 0 0 10px; white-space: pre-wrap; }
.fq .err { color: var(--red); font-size: 13.5px; margin-top: 8px; display: none; }
.fq.bad { border-color: var(--red); }
.fq.bad .err { display: block; }
.choice { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; font-size: 15.5px; }
.choice input { width: 18px; height: 18px; accent-color: var(--blue); margin: 0; flex: none; }
.choice .other-in { flex: 1; }
.scale { display: flex; align-items: end; gap: 6px; flex-wrap: wrap; justify-content: center; text-align: center; }
.scale label { display: grid; gap: 6px; justify-items: center; cursor: pointer; min-width: 34px; font: 500 14px var(--ui); }
.scale label input { width: 20px; height: 20px; accent-color: var(--blue); margin: 0; }
.scale .end { font-size: 13.5px; color: var(--charcoal); align-self: center; padding: 0 6px; }
.fill-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.foot { text-align: center; padding: 24px 0 40px; font: 500 12.5px var(--ui); color: var(--slate); }
.foot a { text-decoration: none; }
.section-card h2 { margin-bottom: 4px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--obsidian); color: #fff; font: 500 14px var(--ui); padding: 11px 18px; border-radius: 100px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
