/* Painel administrativo — complementa styles.css */
body.admin { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- Login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); }
.login-card h1 { margin: 24px 0 6px; font-size: 28px; letter-spacing: -0.02em; }
.login-card .muted { margin: 0 0 28px; }
.back-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.back-link:hover { color: var(--text); }
.btn.full { width: 100%; margin-top: 4px; }

/* ---------- Campos ---------- */
.lbl { display: block; margin: 18px 0 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.lbl:first-child { margin-top: 0; }
.inp, .sel, .txt {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.inp:focus, .sel:focus, .txt:focus { border-color: var(--accent); }
.txt { min-height: 96px; resize: vertical; line-height: 1.5; }
.txt.tall { min-height: 220px; }
.sel { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.sel option { background: var(--surface); }
.help { margin: 6px 0 0; font-size: 12.5px; color: var(--faint); }
.help code { color: var(--muted); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.switch { display: flex; align-items: flex-start; gap: 12px; margin: 18px 0 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { flex: none; position: relative; width: 38px; height: 22px; margin-top: 1px; border-radius: 99px; background: var(--line-strong); transition: background 0.2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch .sw-text { display: grid; gap: 2px; }
.switch .sw-text small { color: var(--faint); font-size: 12.5px; }

/* ---------- Layout ---------- */
.panel { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 24px 16px; border-right: 1px solid var(--line); background: #050505; }
.side-head { display: grid; gap: 4px; padding: 0 8px; }
.tabs { display: grid; gap: 2px; }
.tab { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 10px 12px; background: none; border: 0; border-radius: 8px; color: var(--muted); text-align: left; cursor: pointer; font-size: 14px; }
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.tab .count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.main { min-width: 0; padding: 40px clamp(16px, 4vw, 56px) 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card > .help:first-of-type { margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-wrap { max-width: 760px; }

.savebar { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding: 12px 12px 12px 18px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.savebar .status { font-size: 13px; color: var(--muted); }
.savebar .status.dirty { color: #f5c26b; }
.form-error { margin: 0; color: var(--danger); font-size: 14px; }

/* ---------- Perguntas ---------- */
.qlist { display: grid; gap: 10px; }
.qitem { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; transition: border-color 0.2s; }
.qitem.open { border-color: var(--line-strong); }
.qhead { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; }
.qnum { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.qsummary { flex: 1; min-width: 0; background: none; border: 0; padding: 4px 0; text-align: left; cursor: pointer; }
.qsummary strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.badge { font-size: 11.5px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.badge.req { border-color: rgba(61, 220, 151, 0.35); color: var(--accent); }
.qtools { display: flex; gap: 2px; }
.ibtn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: none; border: 0; color: var(--muted); cursor: pointer; }
.ibtn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.ibtn:disabled { opacity: 0.25; cursor: default; }
.ibtn.danger:hover:not(:disabled) { color: var(--danger); }
.qbody { padding: 4px 20px 20px; border-top: 1px solid var(--line); }
.opts { display: grid; gap: 8px; }
.opt-row { display: flex; gap: 6px; align-items: center; }
.opt-row .inp { flex: 1; }
.add-opt { margin-top: 10px; }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 12px; }

/* ---------- Leads ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .inp { max-width: 320px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.stat b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 500; color: var(--muted); background: #070707; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.lead-row { cursor: pointer; }
tr.lead-row:hover td { background: #0a0a0a; }
td.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
.detail td { background: #070707; }
.answers { display: grid; gap: 10px; margin: 0; }
.answers dt { font-size: 12.5px; color: var(--muted); }
.answers dd { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.detail-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
a.plain { color: var(--accent); text-decoration: none; }
a.plain:hover { text-decoration: underline; }

.preview { margin-top: 10px; padding: 14px 16px; background: #0b1a12; border: 1px solid rgba(61, 220, 151, 0.2); border-radius: 12px 12px 12px 4px; white-space: pre-wrap; font-size: 14px; color: #dff7ea; }
.ok { color: var(--accent); }
.bad { color: var(--danger); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); padding: 12px 18px; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s var(--ease); z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 107, 107, 0.5); color: #ffb3b3; }

/* ---------- Celular ---------- */
@media (max-width: 860px) {
  .panel { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 10; height: auto; gap: 12px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-head { display: none; }
  .tabs { display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .tab { white-space: nowrap; width: auto; }
  .tab[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
  .side-foot { display: none; }
  .main { padding: 24px 16px 120px; }
  .grid2 { grid-template-columns: 1fr; }
  .qhead { flex-wrap: wrap; padding: 12px; }
  .qsummary { flex-basis: calc(100% - 40px); }
  .qtools { width: 100%; justify-content: flex-end; }
  .card { padding: 18px; }
  .mobile-only { display: inline-flex !important; }
}
.mobile-only { display: none !important; }
