/* ── Design tokens (same palette as public site) ──────────────────────────── */
:root {
  --ink:       #233D4D;
  --ink-2:     #3A5568;
  --ink-3:     #6E8294;
  --pumpkin:   #FE7F2D;
  --pumpkin-d: #EA6A16;
  --gold:      #FCCA46;
  --olive:     #A1C181;
  --seagrass:  #619B8A;
  --error:     #E07A63;
  --paper:     #FFFFFF;
  --paper-2:   #F8F6F1;
  --paper-3:   #F2EFE8;
  --line:      #E9E5DC;
  --line-2:    #DED9CD;
  --nav-h:     60px;
  --sans:      "Schibsted Grotesk", system-ui, -apple-system, sans-serif;
  --mono:      "Space Mono", ui-monospace, monospace;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(35,61,77,.06), 0 2px 8px rgba(35,61,77,.05);
  --shadow-md: 0 4px 12px rgba(35,61,77,.08), 0 12px 28px rgba(35,61,77,.07);
}

/* ── Reset ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--sans); color: var(--ink); background: var(--paper-2); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ── Navigation ──────────────────────────────────────────────────────────────── */
.admin-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--ink);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  box-shadow: 0 1px 0 rgba(255,255,255,.08);
}
.admin-nav__left  { display: flex; align-items: center; gap: 2rem; }
.admin-nav__right { display: flex; align-items: center; gap: 1rem; }

.admin-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1rem; color: #fff; letter-spacing: -.02em;
}
.admin-brand__mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--pumpkin); color: #fff;
  display: grid; place-items: center;
}

.admin-nav__links { display: flex; gap: 4px; }
.admin-nav__links a {
  padding: 6px 14px; border-radius: var(--r-sm);
  font-size: .875rem; font-weight: 500; color: rgba(255,255,255,.65);
  transition: all .15s;
}
.admin-nav__links a:hover { color: #fff; background: rgba(255,255,255,.08); }
.admin-nav__links a.active { color: #fff; background: rgba(255,255,255,.12); font-weight: 600; }

.admin-nav__user { font-size: .8rem; color: rgba(255,255,255,.5); font-family: var(--mono); }
.btn-nav-logout {
  font-size: .8rem; padding: 5px 12px; border-radius: 99px; border: none;
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.7);
  transition: all .15s; cursor: pointer;
}
.btn-nav-logout:hover { background: rgba(255,255,255,.18); color: #fff; }

/* ── Page layout ─────────────────────────────────────────────────────────────── */
.admin-page { padding-top: calc(var(--nav-h) + 2rem); padding-bottom: 3rem; }
.admin-container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.admin-container--narrow { max-width: 540px; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap; }
.page-header h1 { font-size: 1.4rem; font-weight: 800; letter-spacing: -.025em; }
.page-header p { font-size: .875rem; color: var(--ink-3); margin-top: 2px; }

/* ── Card ────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--paper); border-radius: var(--r-lg);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .45em;
  font-weight: 600; font-size: .875rem; padding: 9px 18px; border-radius: 99px;
  border: none; cursor: pointer; transition: all .15s; white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--pumpkin); color: #fff; box-shadow: 0 4px 14px rgba(254,127,45,.3); }
.btn-primary:hover { background: var(--pumpkin-d); transform: translateY(-1px); }
.btn-secondary { background: var(--paper); color: var(--ink); border: 1.5px solid var(--line-2); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-danger { background: rgba(224,122,99,.12); color: #c0533a; border: 1.5px solid rgba(224,122,99,.3); }
.btn-danger:hover { background: rgba(224,122,99,.2); }
.btn-ghost { background: transparent; color: var(--ink-3); border: none; padding: 8px 12px; }
.btn-ghost:hover { color: var(--ink); background: var(--paper-3); border-radius: var(--r-sm); }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: .95rem; }
.btn-full { width: 100%; justify-content: center; }

/* Icon buttons */
.btn-icon {
  width: 32px; height: 32px; border-radius: var(--r-sm); border: none; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3); cursor: pointer; transition: all .15s; font-size: .9rem;
}
.btn-icon:hover { background: var(--paper-3); color: var(--ink); }
.btn-icon--danger:hover { background: rgba(224,122,99,.12); color: #c0533a; }
.btn-icon--primary:hover { background: rgba(254,127,45,.1); color: var(--pumpkin); }

/* ── Form inputs ─────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 1rem; }
.field label, .field-label { font-size: .8rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.field-hint { font-size: .78rem; color: var(--ink-3); margin-top: 3px; }

.input {
  width: 100%; padding: 9px 13px; font-size: .9rem; font-family: var(--sans);
  border: 1.5px solid var(--line-2); border-radius: var(--r-md);
  background: var(--paper); color: var(--ink);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.input:focus { border-color: var(--pumpkin); box-shadow: 0 0 0 3px rgba(254,127,45,.12); }
.input:disabled { background: var(--paper-3); color: var(--ink-3); }
.input.invalid { border-color: var(--error); box-shadow: 0 0 0 3px rgba(224,122,99,.12); }
textarea.input { resize: vertical; min-height: 80px; }
select.input { cursor: pointer; }

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.input-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }

/* ── Toggle switch ───────────────────────────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: .65rem; cursor: pointer; user-select: none; }
.toggle {
  position: relative; width: 44px; height: 24px;
  background: var(--line-2); border-radius: 99px;
  transition: background .2s; flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s;
}
.toggle.on { background: var(--olive); }
.toggle.on::after { transform: translateX(20px); }
.toggle-label { font-size: .875rem; font-weight: 600; color: var(--ink-2); }

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 99px;
  font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap;
}
.badge-qcm       { background: rgba(254,127,45,.12); color: var(--pumpkin-d); }
.badge-vrai_faux { background: rgba(97,155,138,.12);  color: #2d6057; }
.badge-dev       { background: rgba(252,202,70,.2);   color: #7a5a00; }
.badge-free      { background: rgba(161,193,129,.15); color: #3d6624; }
.badge-paid      { background: rgba(35,61,77,.08);    color: var(--ink-2); }
.badge-published { background: rgba(161,193,129,.15); color: #3d6624; }
.badge-draft     { background: rgba(224,122,99,.1);   color: #c0533a; }

/* ── Table ───────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--paper); }
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table thead { background: var(--paper-2); border-bottom: 1.5px solid var(--line); }
.data-table th {
  padding: 10px 14px; text-align: left;
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3);
  white-space: nowrap;
}
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--ink); }
.data-table td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: var(--paper-2); }
.data-table tbody tr.selected { background: rgba(254,127,45,.04); }
.data-table .col-check { width: 40px; }
.data-table .col-num   { width: 52px; color: var(--ink-3); font-family: var(--mono); font-size: .8rem; }
.data-table .col-actions { width: 110px; white-space: nowrap; }
.data-table .text-muted { color: var(--ink-3); font-size: .82rem; }

/* Truncated question text */
.q-text { max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.q-text p, .q-text * { display: inline; }

/* ── Filters toolbar ─────────────────────────────────────────────────────────── */
.filters-bar {
  display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filter-select {
  padding: 7px 12px; font-size: .85rem; font-family: var(--sans);
  border: 1.5px solid var(--line-2); border-radius: 99px;
  background: var(--paper); color: var(--ink); cursor: pointer; outline: none;
  transition: border-color .15s;
}
.filter-select:focus { border-color: var(--pumpkin); }
.search-input {
  padding: 7px 14px 7px 36px; font-size: .85rem;
  border: 1.5px solid var(--line-2); border-radius: 99px;
  background: var(--paper); color: var(--ink); outline: none;
  transition: border-color .15s; min-width: 200px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236E8294' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center;
}
.search-input:focus { border-color: var(--pumpkin); }
.filters-bar .spacer { flex: 1; }

/* ── Bulk action bar ─────────────────────────────────────────────────────────── */
.bulk-bar {
  display: none; align-items: center; gap: .75rem;
  padding: 8px 14px; border-radius: var(--r-md);
  background: rgba(254,127,45,.08); border: 1px solid rgba(254,127,45,.2);
  margin-bottom: .75rem; font-size: .875rem;
}
.bulk-bar.show { display: flex; }
.bulk-bar strong { color: var(--pumpkin-d); }

/* ── Stats cards ─────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .85rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.1rem 1.25rem; }
.stat-card__num { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; color: var(--ink); line-height: 1; }
.stat-card__lbl { font-size: .78rem; color: var(--ink-3); margin-top: 4px; font-weight: 500; }
.stat-card--orange .stat-card__num { color: var(--pumpkin); }
.stat-card--green  .stat-card__num { color: var(--seagrass); }

/* ── Editor split layout ─────────────────────────────────────────────────────── */
.editor-split {
  display: grid; grid-template-columns: 1fr 380px; gap: 1.25rem; align-items: start;
}
.editor-form  { display: flex; flex-direction: column; gap: 0; }
.editor-preview { position: sticky; top: calc(var(--nav-h) + 1.25rem); }

.preview-box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.preview-box__header { padding: .65rem 1rem; background: var(--paper-2); border-bottom: 1px solid var(--line); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); display: flex; align-items: center; gap: .5rem; }
.preview-box__body { padding: 1.25rem; }

/* Preview renders exactly like the public quiz */
.preview-statement { font-size: 1rem; font-weight: 600; color: var(--ink); margin-bottom: 1rem; line-height: 1.55; }
.preview-statement p { color: var(--ink); }
.preview-statement mark { background: rgba(252,202,70,.45); border-radius: 3px; padding: 0 2px; }
.preview-options { display: flex; flex-direction: column; gap: 8px; }
.preview-option {
  display: flex; align-items: center; gap: .75rem;
  padding: 10px 14px; border-radius: 99px;
  border: 1.5px solid var(--line-2); background: var(--paper);
  font-size: .9rem; font-weight: 500; color: var(--ink);
}
.preview-option.correct { border-color: var(--olive); background: rgba(161,193,129,.1); color: #3d6624; font-weight: 700; }
.preview-option::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--line-2); flex-shrink: 0;
}
.preview-option.correct::before { background: var(--olive); border-color: var(--olive); }
.preview-empty { text-align: center; padding: 2rem; color: var(--ink-3); font-size: .85rem; }

/* ── Rich text editor ────────────────────────────────────────────────────────── */
.rte-wrap { border: 1.5px solid var(--line-2); border-radius: var(--r-md); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.rte-wrap:focus-within { border-color: var(--pumpkin); box-shadow: 0 0 0 3px rgba(254,127,45,.12); }
.rte-toolbar {
  display: flex; align-items: center; gap: 2px; padding: 5px 8px;
  background: var(--paper-2); border-bottom: 1px solid var(--line);
}
.rte-btn {
  width: 28px; height: 28px; border-radius: 5px; border: none; background: transparent;
  font-size: .85rem; font-family: var(--sans); cursor: pointer; color: var(--ink-2);
  display: grid; place-items: center; transition: all .15s;
}
.rte-btn:hover  { background: var(--paper-3); color: var(--ink); }
.rte-btn.active { background: var(--ink); color: #fff; }
.rte-btn-mark { font-size: .75rem; font-weight: 700; background: rgba(252,202,70,.4); border-radius: 3px; padding: 1px 3px; }
.rte-divider { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.rte-editor {
  padding: 10px 13px; min-height: 90px; outline: none;
  font-size: .9rem; line-height: 1.6; color: var(--ink);
}
.rte-editor:empty::before { content: attr(data-placeholder); color: var(--ink-3); pointer-events: none; }
.rte-editor mark { background: rgba(252,202,70,.45); border-radius: 3px; padding: 0 2px; }
.rte-editor p { margin-bottom: .4em; }

/* ── Options builder ─────────────────────────────────────────────────────────── */
.options-list { display: flex; flex-direction: column; gap: .5rem; }
.option-row {
  display: flex; align-items: center; gap: .65rem;
  padding: 8px 10px; border-radius: var(--r-md);
  background: var(--paper-2); border: 1.5px solid var(--line);
  transition: border-color .15s;
}
.option-row.is-correct { border-color: var(--olive); background: rgba(161,193,129,.08); }
.option-key {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  background: var(--line); display: grid; place-items: center;
  font-weight: 800; font-size: .8rem; font-family: var(--mono); color: var(--ink-2);
}
.option-row.is-correct .option-key { background: var(--olive); color: #fff; }
.option-correct-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line-2);
  background: #fff; cursor: pointer; flex-shrink: 0; transition: all .15s;
  display: grid; place-items: center; font-size: .7rem;
}
.option-correct-btn:hover  { border-color: var(--olive); color: var(--olive); }
.option-row.is-correct .option-correct-btn { border-color: var(--olive); background: var(--olive); color: #fff; }
.option-text { flex: 1; padding: 4px 8px; border: none; background: transparent; font: inherit; font-size: .875rem; outline: none; color: var(--ink); }
.option-text::placeholder { color: var(--ink-3); }

/* ── Image upload ────────────────────────────────────────────────────────────── */
.img-upload-zone {
  border: 2px dashed var(--line-2); border-radius: var(--r-md); padding: 1.5rem;
  text-align: center; cursor: pointer; transition: all .15s; position: relative;
}
.img-upload-zone:hover { border-color: var(--pumpkin); background: rgba(254,127,45,.03); }
.img-upload-zone.drag-over { border-color: var(--pumpkin); background: rgba(254,127,45,.06); }
.img-upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.img-upload-zone p { font-size: .85rem; color: var(--ink-3); line-height: 1.5; }
.img-upload-zone strong { color: var(--pumpkin); }
.img-preview-grid { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.img-preview-item { position: relative; }
.img-preview-item img { width: 80px; height: 60px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); }
.img-preview-item .remove-img {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--error); color: #fff; border: none;
  font-size: .75rem; cursor: pointer; display: grid; place-items: center;
}

/* ── Type selector ───────────────────────────────────────────────────────────── */
.type-btns { display: flex; gap: .5rem; }
.type-btn {
  flex: 1; padding: 9px 14px; border-radius: var(--r-md); border: 1.5px solid var(--line-2);
  background: var(--paper); font-size: .85rem; font-weight: 600; cursor: pointer;
  transition: all .15s; text-align: center; color: var(--ink-2);
}
.type-btn:hover { border-color: var(--ink-2); color: var(--ink); }
.type-btn.active.qcm       { border-color: var(--pumpkin); background: rgba(254,127,45,.08); color: var(--pumpkin-d); }
.type-btn.active.vrai_faux { border-color: var(--seagrass); background: rgba(97,155,138,.08); color: #2d6057; }
.type-btn.active.dev       { border-color: var(--gold); background: rgba(252,202,70,.12); color: #7a5a00; }

/* ── Alert / toast ───────────────────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--r-md); font-size: .875rem; margin-bottom: 1rem; }
.alert-error   { background: rgba(224,122,99,.1); color: #9f3a28; border: 1px solid rgba(224,122,99,.25); }
.alert-success { background: rgba(161,193,129,.1); color: #3d6624; border: 1px solid rgba(161,193,129,.3); }
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; padding: .65rem 1.1rem;
  border-radius: 99px; font-size: .875rem; font-weight: 600; z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,.15); animation: toastIn .25s ease;
  display: flex; align-items: center; gap: .5rem;
}
.toast-success { background: var(--ink); color: #fff; }
.toast-error   { background: var(--error); color: #fff; }
@keyframes toastIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* ── Spinner ─────────────────────────────────────────────────────────────────── */
.spinner { display: flex; justify-content: center; padding: 3rem; }
.spinner::after {
  content: ''; width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--pumpkin);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--ink-3); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .4; }
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--ink-2); margin-bottom: .35rem; }
.empty-state p  { font-size: .875rem; }

/* ── Auth page ───────────────────────────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); }
.auth-card {
  background: var(--paper); border-radius: var(--r-lg); padding: 2.25rem;
  width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.auth-card__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 1.75rem; }
.auth-card__brand .mark { width: 36px; height: 36px; border-radius: 9px; background: var(--pumpkin); display: grid; place-items: center; color: #fff; }
.auth-card__brand span { font-weight: 800; font-size: 1.1rem; color: var(--ink); }
.auth-card__brand small { font-size: .78rem; color: var(--ink-3); display: block; font-weight: 400; }
.submit-btn {
  width: 100%; height: 48px; border-radius: 99px; background: var(--pumpkin); color: #fff;
  font-weight: 700; font-size: .95rem; font-family: var(--sans); border: none; cursor: pointer;
  box-shadow: 0 6px 18px rgba(254,127,45,.35); transition: all .15s;
}
.submit-btn:hover { background: var(--pumpkin-d); transform: translateY(-1px); }
.submit-btn:disabled { opacity: .6; transform: none; cursor: not-allowed; }

/* ── Pagination ──────────────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-top: 1px solid var(--line); font-size: .82rem; color: var(--ink-3); }
.pagination__btns { display: flex; gap: .35rem; }
.page-btn { width: 30px; height: 30px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper); font-size: .82rem; cursor: pointer; display: grid; place-items: center; transition: all .15s; }
.page-btn:hover { border-color: var(--ink); color: var(--ink); }
.page-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Category drag list ──────────────────────────────────────────────────────── */
.cat-list { display: flex; flex-direction: column; gap: .4rem; }
.cat-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .85rem; border-radius: var(--r-md);
  background: var(--paper); border: 1px solid var(--line);
  transition: box-shadow .15s;
}
.cat-row.dragging { opacity: .5; box-shadow: var(--shadow-md); }
.cat-row.drag-over { border-color: var(--pumpkin); background: rgba(254,127,45,.04); }
.cat-drag-handle { cursor: grab; color: var(--ink-3); font-size: 1rem; padding: 2px; }
.cat-drag-handle:active { cursor: grabbing; }
.cat-name { flex: 1; font-weight: 600; font-size: .9rem; }
.cat-count { font-size: .78rem; color: var(--ink-3); font-family: var(--mono); }

/* ── Block editor ────────────────────────────────────────────────────────────── */
.be-wrap { display: flex; flex-direction: column; gap: .5rem; }
.be-block {
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  background: var(--paper); overflow: hidden;
}
.be-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .4rem .65rem; background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.be-type-label {
  font-family: var(--mono); font-size: .65rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
}
.be-controls { display: flex; gap: .25rem; }
.be-btn {
  background: none; border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 6px; font-size: .78rem; color: var(--ink-2); cursor: pointer;
  line-height: 1.6; transition: background .1s;
}
.be-btn:hover:not(:disabled) { background: var(--line); }
.be-btn:disabled { opacity: .35; cursor: default; }
.be-btn-del { color: var(--error); border-color: transparent; }
.be-btn-del:hover { background: rgba(224,122,99,.12); }
.be-block-body { padding: .5rem; }
.be-img-zone { padding: 1rem; }
.be-img-preview { position: relative; }
.be-img-preview img { max-width: 100%; border-radius: 6px; display: block; border: 1px solid var(--line); }
.be-img-rm {
  position: absolute; top: .4rem; right: .4rem;
  background: rgba(0,0,0,.55); color: #fff; border: none;
  border-radius: 4px; padding: 2px 8px; font-size: .75rem; cursor: pointer;
}
.be-toolbar {
  display: flex; gap: .5rem; padding: .25rem 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .editor-split { grid-template-columns: 1fr; }
  .editor-preview { position: static; }
  .input-row, .input-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .admin-nav__links { display: none; }
  .q-text { max-width: 160px; }
  .page-header { flex-direction: column; align-items: flex-start; }
}
