:root {
  --accent: #059669;
  --accent-2: #10b981;
  --accent-dark: #047857;
  --accent-tint: #ecfdf5;
  --bg: #f4faf7;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-faint: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --good: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(3,46,74,.06), 0 2px 10px -4px rgba(3,46,74,.10);
  --shadow: 0 18px 44px -20px rgba(3,46,74,.30);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }

/* ---------- Layout ---------- */
.topbar {
  height: 60px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 20;
}
.logo { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.logo img { height: 26px; width: auto; display: block; }
.logo .sep { width: 1px; height: 22px; background: var(--line-strong); }
.logo .word { font-weight: 650; font-size: 16px; letter-spacing: -.01em; color: var(--ink); }
.topbar .spacer { flex: 1; }
.wrap { max-width: 1060px; margin: 0 auto; padding: 30px 22px 80px; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  font-weight: 600; font-size: 14px; border-radius: 10px; padding: 9px 16px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .12s, border-color .12s, transform .08s, opacity .12s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #fff; box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn-primary:hover { background: linear-gradient(180deg, var(--accent), var(--accent-dark)); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line-strong); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-faint); background: #fff; }
.btn-subtle { background: #eef1f7; color: var(--ink); }
.btn-subtle:hover { background: #e5e9f2; }
.btn-danger { background: transparent; color: var(--bad); border-color: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 10%, #fff); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.iconbtn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer;
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-soft); transition: background .12s, color .12s, border-color .12s;
}
.iconbtn:hover { color: var(--ink); border-color: var(--ink-faint); }
.iconbtn:disabled { opacity: .35; cursor: not-allowed; }

.seg { display: inline-flex; background: #eef1f7; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  border: none; background: none; cursor: pointer; font-weight: 600; font-size: 13px;
  padding: 6px 12px; border-radius: 7px; color: var(--ink-soft);
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- Cards ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.scard { padding: 20px; display: flex; flex-direction: column; gap: 14px; cursor: pointer; transition: box-shadow .15s, transform .1s, border-color .15s; }
.scard:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--line-strong); }
.scard h3 { margin: 0; font-size: 16.5px; letter-spacing: -.01em; }
.scard .meta-row { display: flex; align-items: center; gap: 8px; }
.scard .stat-row { display: flex; gap: 18px; margin-top: auto; }
.scard .stat { display: flex; flex-direction: column; }
.scard .stat b { font-size: 21px; letter-spacing: -.02em; }
.scard .stat span { font-size: 12px; color: var(--ink-faint); }

.badge { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; text-transform: uppercase; letter-spacing: .03em; }
.badge.active { background: color-mix(in srgb, var(--good) 15%, #fff); color: var(--good); }
.badge.draft { background: #eef1f7; color: var(--ink-soft); }
.badge.closed { background: color-mix(in srgb, var(--bad) 12%, #fff); color: var(--bad); }
.badge.lang { background: color-mix(in srgb, var(--accent) 12%, #fff); color: var(--accent); }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 25px; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--ink-soft); }
.page-head .spacer { flex: 1; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--ink-faint); font-size: 13px; margin-bottom: 14px; }
.crumbs a { color: var(--ink-soft); font-weight: 600; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.tabs button {
  border: none; background: none; cursor: pointer; font-weight: 600; font-size: 14.5px;
  padding: 12px 4px; margin-right: 22px; color: var(--ink-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.on { color: var(--accent); border-color: var(--accent); }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 7px; }
.field .hint { color: var(--ink-faint); font-weight: 400; font-size: 12.5px; margin-left: 6px; }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 14.5px; color: var(--ink); background: #fff; transition: border-color .12s, box-shadow .12s;
}
.textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
}
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; font-weight: 500; }
.switch input { display: none; }
.switch .track { width: 40px; height: 23px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(17px); }

.swatches { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }

/* ---------- Question editor ---------- */
.qcard { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; background: #fff; }
.qcard .qhead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.qcard .qhead .type-pill { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, #fff); padding: 4px 9px; border-radius: 7px; }
.qcard .qhead .grip { color: var(--ink-faint); font-weight: 700; }
.qcard .qhead .spacer { flex: 1; }
.qconfig { margin-top: 12px; padding-top: 14px; border-top: 1px dashed var(--line); }
.opt-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-row .input { flex: 1; }

.add-q { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.add-q button { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
  border: 1px dashed var(--line-strong); background: #fff; border-radius: 11px; padding: 11px 14px; cursor: pointer;
  transition: border-color .12s, background .12s; min-width: 130px; }
.add-q button:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, #fff); }
.add-q button b { font-size: 14px; }
.add-q button small { color: var(--ink-faint); font-size: 12px; }

/* ---------- Share ---------- */
.linkbox { display: flex; gap: 8px; align-items: center; }
.linkbox .input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.code { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5;
  background: #0f1522; color: #d7e0f0; border-radius: 12px; padding: 16px; border: none; min-height: 220px; resize: vertical; }
.help { background: color-mix(in srgb, var(--accent) 6%, #fff); border: 1px solid color-mix(in srgb, var(--accent) 18%, #fff);
  border-radius: 12px; padding: 14px 16px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.55; }
.help code { background: #fff; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); font-size: 12.5px; color: var(--ink); }

/* ---------- Results ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 26px; }
.kpi { padding: 18px 20px; }
.kpi .label { font-size: 12.5px; color: var(--ink-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 34px; font-weight: 750; letter-spacing: -.03em; margin-top: 6px; line-height: 1; }
.kpi .sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; }
.kpi .value.good { color: var(--good); } .kpi .value.warn { color: var(--warn); } .kpi .value.bad { color: var(--bad); }

.result-block { padding: 22px; margin-bottom: 18px; }
.result-block h3 { margin: 0 0 4px; font-size: 16px; }
.result-block .qtype { font-size: 12px; color: var(--ink-faint); font-weight: 600; margin-bottom: 16px; }

.nps-split { display: flex; height: 16px; border-radius: 8px; overflow: hidden; margin: 14px 0 8px; background: var(--line); }
.nps-split > i { display: block; height: 100%; }
.nps-split .p { background: var(--good); } .nps-split .n { background: var(--warn); } .nps-split .d { background: var(--bad); }
.nps-legend { display: flex; gap: 18px; font-size: 13px; color: var(--ink-soft); }
.nps-legend b { color: var(--ink); }
.dot-i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

.bars { display: flex; flex-direction: column; gap: 9px; margin-top: 8px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 52px; align-items: center; gap: 12px; font-size: 13.5px; }
.bar-row .track { background: var(--line); border-radius: 6px; height: 12px; overflow: hidden; }
.bar-row .track > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.bar-row .val { text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.dist { display: grid; grid-template-columns: repeat(11, 1fr); gap: 5px; margin-top: 10px; align-items: end; height: 90px; }
.dist .col { display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.dist .col .b { width: 100%; background: color-mix(in srgb, var(--accent) 75%, #fff); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .4s; }
.dist .col small { font-size: 11px; color: var(--ink-faint); }

.verbatims { display: flex; flex-direction: column; gap: 10px; }
.verbatim { border-left: 3px solid var(--line-strong); padding: 4px 0 4px 14px; }
.verbatim p { margin: 0; line-height: 1.5; }
.verbatim .who { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

table.resp { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.resp th, table.resp td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.resp th { color: var(--ink-faint); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; font-weight: 700; }
table.resp tr:hover td { background: #fafbfd; }
.table-scroll { overflow-x: auto; }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 70px 20px; color: var(--ink-soft); }
.empty .big { font-size: 46px; margin-bottom: 12px; }
.center-screen { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; padding: 34px 30px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card p { margin: 0 0 22px; color: var(--ink-soft); font-size: 14px; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-text { color: var(--bad); font-size: 13.5px; margin-top: 10px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff;
  padding: 11px 20px; border-radius: 10px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); margin: 26px 0 12px; }
.muted { color: var(--ink-faint); }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 40%); padding: 18px 0 4px; display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; z-index: 5; }

/* ---------- Editeur avec preview live ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 28px; align-items: start; }
.editor-form { min-width: 0; }
.editor-preview { position: sticky; top: 80px; }
@media (max-width: 960px) {
  .editor { grid-template-columns: 1fr; }
  .editor-preview { position: static; order: 0; }
  .device .screen, .email-frame { height: 480px; }
}

.preview-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.preview-head .section-title { margin: 0; flex: 1; }

.device {
  background: #0b1f30;
  border-radius: 26px; padding: 12px; box-shadow: var(--shadow);
  border: 1px solid #0b1f30;
}
.device.email { background: #334155; }
.device .screen { background: var(--bg); border-radius: 16px; overflow: hidden; height: 620px; position: relative; }
.device iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
.preview-hint { text-align: center; font-size: 12px; color: var(--ink-faint); margin-top: 10px; }
.email-frame { width: 100%; height: 620px; border: 0; display: block; background: #f5f8fb; border-radius: 16px; }

.preview-seg { display: inline-flex; background: #eef2f8; border-radius: 9px; padding: 3px; gap: 2px; }
.preview-seg button { border: none; background: none; cursor: pointer; font-weight: 600; font-size: 12.5px; padding: 6px 12px; border-radius: 7px; color: var(--ink-soft); }
.preview-seg button.on { background: #fff; color: var(--accent); box-shadow: var(--shadow-sm); }

.type-menu { position: relative; display: inline-block; }
.type-menu-pop {
  position: absolute; z-index: 30; top: calc(100% + 8px); left: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 8px; width: 300px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.type-menu-pop button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  border: 1px solid transparent; background: none; border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.type-menu-pop button:hover { background: var(--accent-tint); }
.type-menu-pop button b { font-size: 13.5px; }
.type-menu-pop button small { color: var(--ink-faint); font-size: 11.5px; }
.type-menu-pop .ic { font-size: 16px; }

.qcard { transition: box-shadow .15s, border-color .15s; }
.qcard.editing { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.qcard .qhead .num { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-tint); color: var(--accent); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Vue reponses (commercial) ---------- */
.resp-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 26px 0 12px; }
.resp-search { max-width: 260px; padding: 8px 12px; }
@media (max-width: 640px) { .resp-search { max-width: 100%; width: 100%; } .resp-toolbar .spacer { display: none; } }
.npsbadge { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 23px; padding: 0 7px; border-radius: 7px; font-weight: 700; font-size: 13px; color: #fff; font-variant-numeric: tabular-nums; }
.npsbadge.good { background: var(--good); } .npsbadge.warn { background: var(--warn); } .npsbadge.bad { background: var(--bad); }

/* ---------- Responsive (mobile / tablette) ---------- */
.page-head { flex-wrap: wrap; }
@media (max-width: 680px) {
  .topbar { padding: 0 14px; gap: 10px; height: 56px; }
  .logo img { height: 22px; }
  .logo .sep, .logo .word { display: none; }
  .wrap { padding: 20px 14px 64px; }
  .page-head { gap: 12px; }
  .page-head h1 { font-size: 22px; }
  .page-head .spacer { flex-basis: 100%; height: 0; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .tabs button { margin-right: 16px; }
  .grid-cards { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .bar-row { grid-template-columns: 90px 1fr 46px; font-size: 12.5px; }
  .modalcard { max-width: 100%; }
  .sticky-save { flex-wrap: wrap; }
  .btn { padding: 10px 14px; }
}
@media (max-width: 400px) {
  .kpis { grid-template-columns: 1fr; }
  .dist { gap: 3px; }
}

.cbar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.cbar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 99px; transition: width .4s ease; }

.copybar { display:flex; gap:10px; align-items:center; flex-wrap: wrap; }
.qr { background:#fff; border:1px solid var(--line); border-radius:12px; padding:12px; }
.qr img, .qr svg { display:block; width:150px; height:150px; }
