:root {
  --brand: #FF3444;
  --brand-dark: #e62a39;
  --bg: #0f1117;
  --bg2: #0d1117;
  --panel: #161b22;
  --panel2: #21262d;
  --line: #30363d;
  --line2: #21262d;
  --text: #e1e4e8;
  --muted: #8b949e;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 12px;
  width: 100%;
  font-size: 14px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 5px; font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  border-radius: 6px; padding: 0 16px; height: 34px; font-size: 13px; font-weight: 600;
  line-height: 1; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.ghost { background: var(--panel2); border: 1px solid var(--line); color: var(--text); font-weight: 500; }
.btn.ghost:hover { background: var(--line); border-color: #484f58; }
.btn.sm { height: 28px; padding: 0 12px; font-size: 12px; }
.btn.danger { background: var(--panel2); border: 1px solid var(--line); color: #f85149; font-weight: 500; }
.btn.danger:hover { border-color: #f85149; }

/* Login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(ellipse 720px 480px at 50% 50%, rgba(255,52,68,.10), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(48,54,61,.55) 1px, transparent 0) 0 0/28px 28px,
    var(--bg2);
}
.login-card {
  background: var(--panel); padding: 36px; border-radius: 12px;
  width: 340px; border: 1px solid var(--line);
  box-shadow: 0 0 100px rgba(255,52,68,.12), 0 12px 40px rgba(0,0,0,.6);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; font-weight: 500; }
.login-card .err { color: #f85149; font-size: 13px; min-height: 18px; margin-top: 10px; font-weight: 500; }

/* Top bar */
.top { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--panel); }
.top .logo { font-weight: 800; color: var(--brand); letter-spacing: .5px; }
.top .crumb { color: var(--muted); font-size: 14px; font-weight: 500; }
.top .crumb a { color: var(--text); text-decoration: none; }
.top .spacer { flex: 1; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 22px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }

/* Cards grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: border-color .15s;
}
.card:hover { border-color: var(--brand); }
.card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.card .meta { color: var(--muted); font-size: 12px; }
.card .acts { margin-top: 12px; display: flex; gap: 8px; }

.empty { color: var(--muted); margin-top: 30px; text-align: center; }

/* Editor layout */
.editor { display: grid; grid-template-columns: 230px 1fr 320px; height: calc(100vh - 57px); }
.steps-col { border-right: 1px solid var(--line); padding: 16px 12px; overflow-y: auto; background: var(--panel); }
.step-tab {
  display: flex; align-items: center; gap: 9px; padding: 11px 12px; border-radius: 8px;
  margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--muted);
  border: 1px solid transparent; cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.step-tab:hover { background: #1c2128; color: var(--text); }
.step-tab.active { background: rgba(255,52,68,.10); border-color: rgba(255,52,68,.30); color: #fff; }
.step-tab .ico { width: 18px; text-align: center; }
.step-tab.active .ico { color: var(--brand); }
.step-tab .del { margin-left: auto; color: var(--muted); font-size: 12px; }
.add-q { margin-top: 8px; width: 100%; }
.steps-sep { height: 1px; background: var(--line2); margin: 10px 4px 12px; }

.preview-col { padding: 26px; overflow-y: auto; display: grid; place-items: start center; background: var(--bg); }
.props-col { border-left: 1px solid var(--line); padding: 18px; overflow-y: auto; background: var(--panel); }
.props-col h4 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.props-col .hint { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; padding: 8px; font-size: 13px; background: var(--bg2); border: 1px solid var(--line); color: var(--muted); border-radius: 6px; transition: border-color .12s, color .12s, background .12s; }
.seg button.on { border-color: var(--brand); color: var(--text); background: rgba(255,52,68,.10); }
.opt-row { display: flex; gap: 6px; margin-bottom: 6px; }
.opt-row input { flex: 1; }
.opt-row button { background: var(--panel2); border: 1px solid var(--line); color: #f85149; border-radius: 6px; padding: 0 10px; }
.chk { display: flex; align-items: center; gap: 8px; margin: 9px 0; font-size: 13px; color: var(--text); }
.chk input { width: auto; }

/* ============================================================
   Live quiz preview — DO NOT restyle (client-facing quiz look).
   Font pinned so the panel font does not bleed into quizzes.
   ============================================================ */
.qp { background: #fff; color: #1a1a2e; border-radius: 14px; width: 100%; max-width: 720px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.35); font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.qp-pad { padding: 30px; }
.qp-split { display: grid; grid-template-columns: 1fr 1fr; }
.qp-split.left { grid-template-columns: 1fr 1fr; }
.qp-media { background: #e7e9f2 center/cover no-repeat; min-height: 280px; }
.qp h2 { font-size: 24px; margin: 0 0 10px; }
.qp p.sub { color: #555; margin: 0 0 18px; white-space: pre-line; }
.qp[dir="rtl"] { direction: rtl; text-align: right; }
.qp-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; }
.qp-back { background: transparent; border: none; color: #8a8a8a; font-size: 14px; cursor: pointer; padding: 8px 4px; }
.qp-next { background: var(--brand); color: #fff; border: none; border-radius: 30px; padding: 12px 30px; font-weight: 600; font-size: 15px; cursor: pointer; }
.qp .brand { font-weight: 700; font-size: 13px; }
.qp .slogan { color: #888; font-size: 12px; }
.qp .cta { background: var(--brand); color: #fff; border: none; border-radius: 30px; padding: 13px 26px; font-weight: 600; margin-top: 6px; }
.qp .opt { border: 1px solid #ddd; border-radius: 9px; padding: 12px 14px; margin: 8px 0; cursor: default; }
.qp .opt:hover { border-color: var(--brand); }
/* Marquiz-style answer options */
.qp-badge { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--brand); color: var(--brand); background: #fff; font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 7px; margin: 0 0 18px; }
.qp-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qp-opt { display: flex; align-items: center; gap: 12px; border: 1px solid #e2e4ee; border-radius: 10px; padding: 14px 16px; background: #fff; cursor: pointer; transition: border-color .15s; }
.qp-opt:hover { border-color: var(--brand); }
.qp-opt .box { width: 20px; height: 20px; border: 1px solid #cfd2e0; border-radius: 5px; flex: none; background: #f3f4f9; }
.qp-opt.other { background: #f3f4f9; color: #9aa0b4; }
@media (max-width: 560px) { .qp-opts { grid-template-columns: 1fr; } }
.qp .progress { height: 6px; background: #eee; border-radius: 4px; overflow: hidden; margin-bottom: 14px; }
.qp .progress i { display: block; height: 100%; width: 80%; background: var(--brand); }
.qp .field { margin: 10px 0; }
.qp .field label { color: #333; font-size: 13px; margin: 0 0 4px; }
.qp .field input { background: #f6f7fb; border: 1px solid #e0e2ee; color: #222; }
.qp .phone { display: flex; gap: 6px; }
.qp .phone .mask { width: 92px; flex: none; }
.qp .tnx-ico { font-size: 40px; }

/* Panel misc */
.muted-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--brand); padding: 11px 18px; border-radius: 9px; font-size: 14px; opacity: 0; transition: opacity .2s; box-shadow: 0 8px 28px rgba(0,0,0,.5); }
.toast.show { opacity: 1; }

/* ===== ANALYTICS-BLOCK ===== */
.dt { width: auto; padding: 6px 9px; font-size: 13px; height: 28px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.kpi .kv { font-size: 28px; font-weight: 700; color: #fff; }
.kpi .kl { color: var(--muted); font-size: 12px; margin-top: 4px; font-weight: 500; }
.a-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.a-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.a-card.span2 { grid-column: span 2; }
.a-card h4 { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
.fun-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: center; margin-bottom: 10px; }
.fun-lbl { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fun-bar { position: relative; background: var(--bg2); border-radius: 6px; height: 26px; overflow: hidden; }
.fun-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-dark)); border-radius: 6px; min-width: 2px; }
.fun-bar span { position: absolute; right: 10px; top: 0; line-height: 26px; font-size: 12px; font-weight: 600; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.sp-col { flex: 1; display: flex; align-items: flex-end; height: 100%; }
.sp-col i { display: block; width: 100%; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.spark-x { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 6px; }
.a-tbl { width: 100%; border-collapse: collapse; }
.a-tbl td { padding: 8px 4px; border-bottom: 1px solid var(--line2); font-size: 13px; }
.a-tbl td.num { text-align: right; font-weight: 600; color: #fff; }
@media (max-width: 760px) { .kpi-row { grid-template-columns: repeat(2,1fr); } .a-grid { grid-template-columns: 1fr; } .a-card.span2 { grid-column: span 1; } .fun-row { grid-template-columns: 110px 1fr; } }

/* ===== CARD-BLOCK ===== */
.quiz-card .qc-head { display:flex; align-items:flex-start; justify-content:space-between; gap:8px; }
.quiz-card .qc-head h3 { margin:0; font-size:16px; }
.qc-rename { background:transparent; border:1px solid var(--line); color:var(--muted); border-radius:6px; width:28px; height:28px; flex:none; font-size:13px; line-height:1; cursor:pointer; transition:border-color .12s, color .12s; }
.qc-rename:hover { border-color:var(--brand); color:var(--text); }
.quiz-card .meta { display:flex; align-items:center; gap:8px; margin:9px 0 2px; }
.q-status { font-size:11px; font-weight:600; padding:2px 10px; border-radius:20px; text-transform:capitalize; background:var(--panel2); border:1px solid var(--line); color:var(--muted); }
.q-status.published { background:rgba(46,160,67,.15); border-color:rgba(46,160,67,.4); color:#3fb950; }
.q-status.draft { background:rgba(187,128,9,.15); border-color:rgba(187,128,9,.4); color:#d29922; }
.q-slug { font-size:12px; color:var(--muted); }
.acts.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:14px; }
.acts.grid2 .btn { width:100%; }

/* ===== MODAL-BLOCK ===== */
.modal-ov { position:fixed; inset:0; background:rgba(10,12,20,.62); display:grid; place-items:center; z-index:9999; padding:20px; animation:mfade .12s ease; }
@keyframes mfade { from { opacity:0 } to { opacity:1 } }
.modal-card { background:var(--panel,#161b22); border:1px solid var(--border,#30363d); border-radius:12px; width:100%; max-width:400px; padding:22px; box-shadow:0 18px 60px rgba(0,0,0,.5); animation:mpop .14s ease; }
@keyframes mpop { from { transform:translateY(8px); opacity:.6 } to { transform:translateY(0); opacity:1 } }
.modal-card h3 { margin:0 0 10px; font-size:17px; }
.modal-msg { margin:0 0 16px; color:var(--muted,#8b949e); font-size:14px; line-height:1.45; }
.modal-card input { width:100%; background:var(--bg,#0d1117); border:1px solid var(--border,#30363d); color:var(--fg,#e6edf3); border-radius:8px; padding:11px 12px; font-size:14px; outline:none; margin-bottom:18px; }
.modal-card input:focus { border-color:var(--brand,#FF3444); }
.modal-acts { display:flex; justify-content:flex-end; gap:10px; }
.btn.mdanger { background:var(--brand,#FF3444); border-color:var(--brand,#FF3444); color:#fff; }
.btn.mdanger:hover { filter:brightness(.92); }

/* ===== LOGO-BLOCK ===== */
.top .logo { display:flex; align-items:center; gap:8px; letter-spacing:normal; }
.logo-mark { width:26px; height:26px; border-radius:7px; background:var(--brand); color:#fff; display:grid; place-items:center; font-weight:800; font-size:16px; line-height:1; }
.logo-word { font-weight:800; font-size:17px; color:var(--text); letter-spacing:-.5px; }
.logo-tag { font-size:10px; font-weight:700; color:var(--brand); border:1px solid var(--brand); border-radius:5px; padding:2px 6px; letter-spacing:1.5px; }
.login-logo { display:flex; align-items:center; gap:8px; justify-content:flex-start; }

/* ===== START-BLOCK (quiz start extras; light client theme) ===== */
.qp-logo { max-height:40px; max-width:60%; margin-bottom:14px; display:block; object-fit:contain; }
.qp[dir="rtl"] .qp-logo { margin-left:auto; }
.qp-bullets { list-style:none; padding:0; margin:16px 0 0; }
.qp-bullets li { position:relative; padding-left:20px; margin:9px 0; color:#333; font-size:14px; line-height:1.45; }
.qp-bullets li::before { content:''; position:absolute; left:0; top:7px; width:8px; height:8px; border-radius:50%; background:var(--brand,#FF3444); }
.qp[dir="rtl"] .qp-bullets li { padding-left:0; padding-right:20px; }
.qp[dir="rtl"] .qp-bullets li::before { left:auto; right:0; }
.qp-feat { margin-top:20px; }
.qp-feat-t { font-weight:700; font-size:13px; color:#1a1a2e; margin-bottom:10px; }
.qp-feat-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.qp-feat-card { display:flex; align-items:center; gap:10px; border:1px solid #e2e4ee; border-radius:10px; padding:10px 12px; background:#fff; }
.qp-feat-img { width:38px; height:38px; flex:none; border-radius:8px; background:#eef0f6 center/cover no-repeat; }
.qp-feat-txt { font-size:13px; color:#333; line-height:1.3; }
.qp-phone { margin-top:16px; font-size:15px; font-weight:700; color:var(--brand,#FF3444); }
@media (max-width:560px){ .qp-feat-grid{ grid-template-columns:1fr; } }
.feat-row { display:grid; grid-template-columns:1fr 1fr auto; gap:6px; margin-bottom:6px; }
.feat-row input { width:100%; }
.feat-row button { background:var(--panel2); border:1px solid var(--line); color:#f85149; border-radius:6px; padding:0 10px; }

/* SETTINGS-SUBTABS-BLOCK */
.subtabs { margin-bottom: 14px; }
.set-body { margin-top: 4px; }
.dom-steps { margin: 14px 0 4px; display: flex; flex-direction: column; gap: 9px; }
.dom-step { font-size: 13px; color: var(--muted); line-height: 1.45; }
.dom-step b { color: var(--text); font-weight: 600; }
