:root {
  --bg: #edf2f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #d7dee8;
  --line-2: #b9c4d3;
  --text: #142033;
  --muted: #667085;
  --blue: #0f4db8;
  --blue-2: #1a73e8;
  --green: #16833a;
  --red: #b3261e;
  --amber: #a15c00;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.09);
  --radius: 16px;
  --font: Inter, Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.empty { padding: 28px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); background: var(--surface-2); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.55; }
.small-space { margin-top: 18px; }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 20%, rgba(15,77,184,.25), transparent 34%),
    linear-gradient(135deg, #07111f, #101b2d 60%, #07111f);
}
.gate-card { width: min(760px, 100%); background: #fff; border-radius: 24px; box-shadow: 0 30px 90px rgba(0,0,0,.35); padding: 24px; }
.gate-brand { display: flex; gap: 18px; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.gate-brand img { width: 110px; height: 110px; object-fit: contain; border-radius: 18px; border: 1px solid var(--line); }
.gate-brand h1 { margin: 0; font-size: 44px; letter-spacing: -1.8px; line-height: .95; }
.eyebrow { color: var(--blue); font-weight: 950; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; margin: 0 0 8px; }
.gate-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 20px 0 14px; }
.gate-tabs button { height: 42px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-weight: 950; color: var(--muted); }
.gate-tabs button.active { background: #eaf2ff; border-color: #bfd7ff; color: var(--blue); }
.gate-panel { display: none; }
.gate-panel.active { display: block; }

label { display: block; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: 11px; font-weight: 950; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; min-height: 42px; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px;
  background: #fff; color: var(--text); outline: none; transition: border .16s, box-shadow .16s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(26, 115, 232, .13); }
.check { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); display: flex; gap: 9px; align-items: center; }
.check input { width: auto; min-height: auto; accent-color: var(--blue); }

.btn { min-height: 38px; border: 1px solid transparent; border-radius: 999px; padding: 0 15px; background: var(--blue); color: #fff; font-weight: 950; }
.btn:hover { background: #0b347a; }
.btn.secondary { background: #fff; color: #344054; border-color: var(--line-2); }
.btn.secondary:hover { background: #f8fafc; }
.btn.danger { background: var(--red); }
.btn.ghost { margin: auto 14px 16px; width: calc(100% - 28px); }
.btn.full { width: 100%; margin-top: 14px; }
.btn.small { min-height: 30px; font-size: 12px; padding: 0 11px; }
.split-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

.app { min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { display: flex; gap: 12px; align-items: center; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.brand img { width: 54px; height: 54px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); }
.brand h2 { margin: 0; font-size: 15px; font-weight: 950; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; word-break: break-word; }
.workspace-box { padding: 14px; border-bottom: 1px solid var(--line); }
.nav { display: grid; gap: 5px; padding: 14px 10px; }
.nav button { min-height: 40px; text-align: left; border: 0; border-radius: 999px; background: transparent; color: #3f4a5c; font-weight: 900; padding: 0 14px; }
.nav button.active, .nav button:hover { background: #eaf2ff; color: var(--blue); }

.main { min-width: 0; }
.topbar { min-height: 72px; background: rgba(255,255,255,.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; padding: 0 24px; position: sticky; top: 0; z-index: 10; }
.topbar h1 { margin: 0; font-size: 21px; letter-spacing: -.4px; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.badge { display: inline-flex; min-height: 26px; align-items: center; border-radius: 999px; padding: 0 10px; background: #eaf2ff; color: var(--blue); border: 1px solid #cfe0ff; font-weight: 950; font-size: 12px; }
.badge.subtle { background: #f8fafc; color: var(--muted); border-color: var(--line); }
.badge.green { background: #effaf2; color: var(--green); border-color: #bce5c8; }
.badge.red { background: #fff4f3; color: var(--red); border-color: #f2b8b5; }
.badge.amber { background: #fff8e7; color: var(--amber); border-color: #ead394; }

.view { display: none; padding: 24px; }
.view.active { display: block; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: 360px minmax(0, 1fr); align-items: start; }
.responses-grid { grid-template-columns: 390px minmax(0, 1fr) !important; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 17px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fff, #fbfdff); }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 950; }
.panel-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.panel-body { padding: 18px 20px 20px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

.list { display: grid; gap: 8px; }
.item { border: 1px solid var(--line); background: #fff; border-radius: 13px; padding: 13px; transition: .16s ease; }
.item.clickable { cursor: pointer; }
.item.clickable:hover, .item.active { border-color: var(--blue); background: #f7fbff; transform: translateY(-1px); }
.item strong { display: block; font-weight: 950; margin-bottom: 4px; }
.item small { display: block; color: var(--muted); line-height: 1.45; }
.item-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.question-card { border: 1px solid var(--line); border-radius: 14px; padding: 15px; margin-top: 12px; background: #fff; }
.question-card h3 { margin: 0 0 6px; font-size: 15px; }
.question-meta { color: var(--muted); font-size: 12px; margin-bottom: 10px; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.metric b { font-size: 28px; letter-spacing: -.6px; }
.metric span { display: block; color: var(--muted); font-size: 12px; font-weight: 950; margin-top: 2px; }
.answer-row { border-top: 1px solid var(--line); padding: 16px 0; }
.answer-row:first-child { border-top: 0; }
.answer-row h3 { margin: 0 0 6px; font-size: 14px; }
.answer-row p { margin: 0; color: #344054; white-space: pre-wrap; line-height: 1.6; }
.score-row { display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: end; margin-top: 10px; }

.public-form { min-height: 100vh; padding: 28px; background: var(--bg); }
.public-shell { width: min(920px, 100%); margin: 0 auto; }
.public-doc { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; margin-top: 16px; }
.public-head { padding: 30px 34px; border-bottom: 1px solid var(--line); }
.public-head img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); margin-bottom: 18px; }
.public-head h1 { margin: 0; font-size: 34px; letter-spacing: -.8px; }
.public-body { padding: 30px 34px 38px; }
.public-question { margin-bottom: 22px; }
.public-question label { color: var(--text); font-size: 14px; text-transform: none; letter-spacing: 0; }
.choice-line { display: flex; gap: 9px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-top: 8px; }
.choice-line input { width: auto; min-height: auto; }

.toast { position: fixed; right: 18px; bottom: 18px; background: var(--blue); color: #fff; border-radius: 999px; padding: 10px 14px; font-size: 12px; font-weight: 950; box-shadow: 0 16px 35px rgba(15,77,184,.3); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s ease; z-index: 9999; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1100px) {
  .app, .grid.two, .responses-grid, .metrics { grid-template-columns: 1fr !important; }
  .sidebar { position: relative; height: auto; }
  .form-grid, .score-row { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .gate-card { padding: 18px; }
  .gate-brand { flex-direction: column; align-items: flex-start; }
  .gate-brand h1 { font-size: 34px; }
  .gate-tabs, .split-actions { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 16px; }
  .view, .public-form { padding: 16px; }
}
