/* Superadmin panel */
:root { --accent: #15171c; --side: 248px; }
body { background: var(--bg); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(700px 360px at 50% -10%, #e6efe9, transparent 70%), var(--bg); }
.login .card { width: min(100%, 400px); padding: 32px 28px; }
.login h1 { font-size: 24px; letter-spacing: -.02em; margin: 18px 0 6px; }
.login p { margin: 0 0 22px; color: var(--muted); font-size: 14.5px; }
.login .stack { display: grid; gap: 14px; }
.login .btn-primary { margin-top: 6px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 17px; color: var(--ink); text-decoration: none; }
.logo small { font-weight: 600; font-size: 11.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: 2px 7px; border-radius: 99px; letter-spacing: 0; }

/* Shell */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 20px 14px; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 22px; }
.side .logo { padding: 4px 8px; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14.5px; transition: background-color .15s; }
.nav a svg { width: 18px; height: 18px; color: var(--muted); }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--ink); color: #fff; }
.nav a.on svg { color: #fff; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 0 4px; }
.side-foot .who { font-size: 13px; color: var(--muted); padding: 0 8px; }
.main { min-width: 0; padding: 28px 36px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 28px; letter-spacing: -.03em; margin: 0; line-height: 1.15; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.page-head .row { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); text-decoration: none; font-weight: 600; margin-bottom: 10px; }
.crumb:hover { color: var(--ink); }
.crumb svg { width: 16px; height: 16px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font-size: 26px; letter-spacing: -.03em; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }

/* Form cards */
.group-title { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin: 26px 0 10px; display: flex; align-items: center; gap: 8px; }
.form-list { display: grid; gap: 10px; }
.form-card { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 18px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s; }
.form-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.form-card h3 { margin: 0 0 4px; font-size: 16.5px; letter-spacing: -.01em; }
.form-card h3 a { color: inherit; text-decoration: none; }
.form-card h3 a:hover { text-decoration: underline; }
.form-card .sub { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; color: var(--muted); }
.form-card .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.count-pill { font-weight: 700; color: var(--ink); }
.empty { padding: 48px 20px; text-align: center; border: 1.5px dashed var(--line-2); border-radius: 18px; color: var(--muted); }
.empty h3 { color: var(--ink); margin: 0 0 6px; }

/* Panels / tables */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.panel-pad { padding: 20px 22px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); max-height: 70vh; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.t th, .t td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.t th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); font-weight: 700; font-size: 12.5px; color: var(--muted); white-space: nowrap; cursor: pointer; user-select: none; }
.t th:hover { color: var(--ink); }
.t th .dir { opacity: .5; margin-left: 4px; }
.t tr:hover td { background: #fbfbf8; }
.t td.wrap { min-width: 240px; max-width: 420px; white-space: pre-wrap; }
.t td.nowrap { white-space: nowrap; }
.score { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }
.score i { display: block; width: 46px; height: 6px; border-radius: 9px; background: var(--line); overflow: hidden; position: relative; }
.score i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--c, #16794c); border-radius: 9px; }
.rank-pill { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 800; }
.rank-pill.top { background: #16794c; color: #fff; border-color: #16794c; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .input, .toolbar .select { min-height: 42px; padding-top: 9px; padding-bottom: 9px; font-size: 14.5px; width: auto; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar .note { font-size: 13px; color: var(--muted); }

.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: #ecece6; width: fit-content; margin-bottom: 20px; max-width: 100%; overflow-x: auto; }
.tabs button { height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; font-weight: 650; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* Summary */
.q-sum { padding: 20px 22px; margin-bottom: 12px; }
.q-sum h3 { margin: 0 0 4px; font-size: 15.5px; letter-spacing: -.01em; }
.q-sum .meta { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(140px, 260px) 1fr 70px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar .track { height: 10px; border-radius: 99px; background: #efefea; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 99px; background: #16794c; }
.bar .n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar .n small { color: var(--muted); font-weight: 600; margin-left: 4px; }
.texts { display: grid; gap: 8px; }
.texts div { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; white-space: pre-wrap; }
.texts div small { display: block; color: var(--muted); font-weight: 600; margin-bottom: 2px; }

/* Responses split */
.split { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.r-list { max-height: 75vh; overflow: auto; padding: 6px; }
.r-row { display: block; width: 100%; text-align: left; padding: 12px 14px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
.r-row:hover { background: var(--surface-2); }
.r-row.on { background: var(--ink); color: #fff; }
.r-row b { display: block; font-size: 14.5px; }
.r-row span { font-size: 12.5px; opacity: .7; }
.detail { padding: 24px 26px; }
.detail h2 { margin: 0 0 4px; letter-spacing: -.02em; }
.detail .meta { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.qa { padding: 14px 0; border-top: 1px solid var(--line); }
.qa .q { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.qa .a { white-space: pre-wrap; font-size: 14.5px; }
.qa .a.none { color: var(--faint); }
.sec-title { margin: 24px 0 4px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent, #16794c); font-weight: 800; }
.item-card { margin-top: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.item-card h4 { margin: 0 0 8px; font-size: 14.5px; display: flex; gap: 8px; align-items: center; }
.item-card dl { margin: 0; display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; font-size: 13.5px; }
.item-card dt { color: var(--muted); font-weight: 600; }
.item-card dd { margin: 0; white-space: pre-wrap; }

/* Builder */
.builder { display: grid; gap: 14px; max-width: 920px; }
.sec-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.sec-head { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(var(--surface-2), var(--surface)); }
.sec-num { width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.sec-head .input { min-height: 42px; padding: 8px 12px; }
.sec-head .title-in { font-weight: 700; font-size: 17px; }
.sec-head .desc-in { margin-top: 8px; font-size: 14px; }
.tools { display: flex; gap: 4px; }
.tools .btn-icon { --h: 34px; width: 34px; border-radius: 9px; background: transparent; color: var(--muted); }
.tools .btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.tools .btn-icon.del:hover { color: var(--danger); background: var(--danger-soft); }
.tools .btn-icon svg { width: 17px; height: 17px; }
.f-list { display: grid; gap: 0; }
.f-row { border-bottom: 1px solid var(--line); }
.f-row:last-child { border-bottom: 0; }
.f-sum { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 12px 18px; cursor: pointer; }
.f-sum:hover { background: #fbfbf8; }
.f-ic { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-2); }
.f-ic svg { width: 16px; height: 16px; }
.f-sum .lbl { font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.f-sum .lbl small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.f-edit { padding: 6px 18px 20px 60px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; background: #fcfcfa; border-top: 1px dashed var(--line); }
.f-edit .full { grid-column: 1 / -1; }
.f-edit .label { font-size: 12.5px; color: var(--muted); margin: 10px 0 5px; font-weight: 700; }
.f-edit .input, .f-edit .select, .f-edit .textarea { min-height: 42px; padding: 9px 12px; font-size: 14.5px; }
.f-edit .textarea { min-height: 90px; }
.f-edit .select { padding-right: 38px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-top: 6px; }
.checks label { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 600; cursor: pointer; }
.checks input { width: 18px; height: 18px; accent-color: var(--ink); }
.nested { grid-column: 1 / -1; margin-top: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.nested-head { padding: 10px 14px; font-size: 12.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.nested .f-edit { padding-left: 18px; }
.add-row { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.add-row .select { width: auto; min-height: 40px; padding: 8px 38px 8px 12px; font-size: 14px; }
.json-area { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; min-height: 60vh; line-height: 1.5; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; max-width: 920px; }
.settings-grid .full { grid-column: 1 / -1; }
.settings-grid .label { margin-top: 14px; font-size: 13.5px; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] { width: 52px; height: 52px; border: 1.5px solid var(--line-2); border-radius: 12px; padding: 4px; background: #fff; cursor: pointer; }
.savebar { position: sticky; top: 0; z-index: 10; margin: -28px -36px 22px; padding: 14px 36px; background: color-mix(in oklab, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.savebar h1 { font-size: 18px; margin: 0; letter-spacing: -.02em; flex: 1; min-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.savebar .dirty { font-size: 12.5px; font-weight: 700; color: #a16207; }
.savebar .btn-primary { --h: 44px; padding: 0 20px; }
.btn-dark { color: #fff; background: var(--ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 8px 18px -10px rgba(0,0,0,.6); }
.btn-dark:hover { background: #2a2d34; transform: translateY(-1px); }

.modal-back { position: fixed; inset: 0; background: rgba(20, 22, 26, .4); display: grid; place-items: center; padding: 16px; z-index: 60; animation: fade-in .2s; }
.modal { width: min(100%, 460px); padding: 26px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); animation: toast-in .3s var(--spring); }
.modal h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.02em; }
.modal p { margin: 0 0 18px; color: var(--muted); font-size: 14.5px; }
.modal .stack { display: grid; gap: 12px; }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
@keyframes fade-in { from { opacity: 0; } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 10px 14px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .nav { display: flex; }
  .side-foot { margin: 0 0 0 auto; display: flex; }
  .side-foot .who { display: none; }
  .main { padding: 20px 16px 80px; }
  .savebar { margin: -20px -16px 18px; padding: 12px 16px; }
  .split { grid-template-columns: 1fr; }
  .form-card { grid-template-columns: 1fr; }
  .form-card .actions { justify-content: flex-start; }
  .f-edit { padding-left: 18px; grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .item-card dl { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 1fr 70px; }
  .bar .track { grid-column: 1 / -1; grid-row: 2; }
}

/* Denser admin scale — the big touch targets belong to the public form, not the back office. */
body { font-size: 14.5px; }
:root { --side: 232px; }
.group-title svg { width: 15px; height: 15px; }
.side { padding: 18px 12px; gap: 18px; }
.logo { font-size: 16px; }
.logo img { width: 26px; height: 26px; }
.nav a { height: 38px; font-size: 14px; }
.nav a svg { width: 17px; height: 17px; }
.main { padding: 26px 32px 72px; max-width: 1280px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 24px; }
.page-head p { font-size: 14px; }
.btn { font-size: 14px; }
.btn-primary { --h: 42px; padding: 0 18px; border-radius: 11px; }
.btn-sm { --h: 36px; font-size: 13.5px; }
.btn-sm.btn-icon { width: 36px; }
.btn svg { width: 16px; height: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 22px; }
.stat { padding: 13px 16px; border-radius: 14px; }
.stat b { font-size: 21px; }
.stat span { font-size: 12.5px; }
.form-card { padding: 15px 18px; border-radius: 14px; }
.form-card h3 { font-size: 15.5px; }
.input, .select, .textarea { min-height: 44px; padding: 10px 13px; font-size: 14.5px; }
.select { padding-right: 40px; background-position: right 12px center; }
.label { font-size: 13.5px; }
.savebar { margin: -26px -32px 20px; padding: 12px 32px; }
.savebar h1 { font-size: 16.5px; }
.savebar .btn-primary { --h: 38px; }
.login .card { padding: 28px 26px; }
@media (max-width: 900px) {
  .main { padding: 18px 16px 72px; }
  .savebar { margin: -18px -16px 16px; padding: 10px 16px; }
}

/* Attachments, links, credentials in responses */
.none { color: var(--faint); }
.att { display: grid; gap: 6px; }
.att a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; min-width: 0; transition: border-color .15s, background-color .15s; }
.att a:hover { border-color: #16794c; background: #f3f9f5; }
.att a > svg { width: 16px; height: 16px; flex: none; color: #16794c; }
.att a > svg:last-child:not(:first-child) { margin-left: auto; color: var(--muted); }
.att a span { display: grid; min-width: 0; }
.att b { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att img { width: 44px; height: 44px; object-fit: cover; border-radius: 7px; flex: none; background: var(--surface-2); }
.t .att a { padding: 5px 8px; }
.creds { display: grid; gap: 10px; }
.cred-card { border: 1px solid #d6e4ff; background: #f6f9ff; border-radius: 12px; padding: 12px 14px; }
.cred-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cred-top svg { width: 16px; height: 16px; color: #2f5bd3; }
.cred-top a { margin-left: auto; font-size: 13px; font-weight: 600; color: #2f5bd3; }
.cred-card dl { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; margin: 0; font-size: 13.5px; align-items: center; }
.cred-card dt { color: var(--muted); font-weight: 600; }
.cred-card dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.cred-card code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; padding: 3px 7px; border-radius: 6px; background: #fff; border: 1px solid #dde6f7; word-break: break-all; }
.cred-card .btn-sm { --h: 30px; padding: 0 10px; font-size: 12.5px; }
.cred-card .btn-sm.btn-icon { width: 30px; padding: 0; }
.item-card dd .att, .item-card dd .creds { margin: 2px 0; }
.toolbar .fi-select, .savebar .fi-select, .add-row .fi-select { width: auto; }
.toolbar .fi-trigger { min-width: 220px; }
.savebar .fi-trigger { min-height: 38px; padding: 6px 36px 6px 12px; font-size: 14px; min-width: 120px; }
