/* ════════════════════════════════════════
   ADMIN — styles du panneau d'administration
════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0d0f14;
  --bg2:      #090b10;
  --bg3:      #13151e;
  --bg4:      #07080d;
  --border:   #1e2230;
  --border2:  #252840;
  --accent:   #4fa8d8;
  --accent-h: #6bbde8;
  --gold:     #b8a040;
  --gold-lt:  #d4bc5a;
  --text:     #eef2f7;
  --muted:    #64748b;
  --muted2:   #8898aa;
  --success:  #10b981;
  --danger:   #ef4444;
  --warning:  #f59e0b;
  --sidebar:  220px;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'Inter', sans-serif; font-size: 14px; }

/* ── Login ── */
#login-screen { display: none; position: fixed; inset: 0; z-index: 999; background: var(--bg); align-items: center; justify-content: center; }
#login-screen.active { display: flex; }
.login-box { background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: 40px 36px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.login-logo { font-family: 'Cinzel', serif; font-size: 1.4rem; color: var(--gold-lt); text-align: center; margin-bottom: 6px; letter-spacing: 0.08em; }
.login-sub { text-align: center; color: var(--muted); font-size: 0.8rem; margin-bottom: 28px; }
.login-error { color: var(--danger); font-size: 0.78rem; margin-bottom: 12px; min-height: 18px; text-align: center; }

/* ── Champs ── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.72rem; font-weight: 600; color: var(--muted2); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; color: var(--text); font-family: 'Inter', sans-serif; font-size: 0.88rem; outline: none; transition: border-color 0.15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 80px; }

/* ── Boutons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 6px; border: none; font-family: 'Inter', sans-serif; font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: all 0.15s; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-danger  { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.3); }
.btn-ghost   { background: transparent; color: var(--muted2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.btn-success { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: rgba(16,185,129,0.28); }
.btn-sm { padding: 5px 12px; font-size: 0.75rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── App shell ── */
#app { display: none; height: 100vh; }
#app.active { display: flex; }

/* ── Sidebar ── */
.sidebar { width: var(--sidebar); flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-brand { padding: 20px 18px 16px; border-bottom: 1px solid var(--border); }
.sidebar-brand-title { font-family: 'Cinzel', serif; font-size: 1rem; color: var(--gold-lt); letter-spacing: 0.06em; }
.sidebar-brand-sub { font-size: 0.65rem; color: var(--muted); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 10px 18px 4px; font-size: 0.6rem; font-weight: 700; color: var(--muted); letter-spacing: 0.15em; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 18px; cursor: pointer; color: var(--muted2); font-size: 0.82rem; font-weight: 500; transition: all 0.15s; border-left: 2px solid transparent; text-decoration: none; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.nav-item.active { color: #fff; background: rgba(58,104,216,0.12); border-left-color: var(--accent); }
.nav-item svg { opacity: 0.7; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sidebar-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #7c3aed); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.sidebar-uname { font-size: 0.82rem; font-weight: 600; }
.sidebar-urole { font-size: 0.65rem; color: var(--muted); }

/* ── Main ── */
.main-area { margin-left: var(--sidebar); flex: 1; display: flex; flex-direction: column; min-width: 0; overflow-y: auto; height: 100vh; }
.topbar { height: 54px; flex-shrink: 0; background: var(--bg2); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 28px; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-size: 1rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.content { padding: 28px; flex: 1; }

/* ── Panels ── */
.panel { display: none; }
.panel.active { display: block; }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 18px 16px; }
.stat-val { font-size: 1.8rem; font-weight: 700; color: #fff; line-height: 1; margin-bottom: 4px; }
.stat-lbl { font-size: 0.72rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-accent-blue   { border-top: 2px solid var(--accent); }
.stat-accent-green  { border-top: 2px solid var(--success); }
.stat-accent-gold   { border-top: 2px solid var(--gold); }
.stat-accent-red    { border-top: 2px solid var(--danger); }
.stat-accent-purple { border-top: 2px solid #8b5cf6; }

/* ── Tableau ── */
.table-wrap { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.table-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.table-title { font-size: 0.85rem; font-weight: 600; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 16px; font-size: 0.68rem; font-weight: 700; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; background: var(--bg2); border-bottom: 1px solid var(--border); }
td { padding: 11px 16px; border-bottom: 1px solid rgba(24,32,56,0.6); vertical-align: middle; font-size: 0.82rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
.td-actions { display: flex; gap: 6px; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 12px; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.badge-published { background: rgba(16,185,129,0.2); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.35); }
.badge-draft     { background: rgba(245,158,11,0.2); color: #fcd34d; border: 1px solid rgba(245,158,11,0.35); }
.badge-admin     { background: rgba(139,92,246,0.2); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.35); }
.badge-editor    { background: rgba(58,104,216,0.2); color: #93c5fd; border: 1px solid rgba(58,104,216,0.35); }
.badge-easy      { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.badge-medium    { background: rgba(245,158,11,0.15); color: #fcd34d; }
.badge-hard      { background: rgba(239,68,68,0.15);  color: #fca5a5; }

/* ── Formulaire ── */
.form-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 24px; max-width: 900px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── Quill ── */
.ql-toolbar  { background: var(--bg2) !important; border-color: var(--border) !important; border-radius: 6px 6px 0 0; }
.ql-container{ background: var(--bg2) !important; border-color: var(--border) !important; border-radius: 0 0 6px 6px; min-height: 320px; font-family: 'Inter', sans-serif !important; font-size: 0.9rem; }
.ql-editor   { color: var(--text) !important; }
.ql-editor.ql-blank::before { color: var(--muted) !important; font-style: italic; }
.ql-stroke   { stroke: var(--muted2) !important; }
.ql-fill     { fill: var(--muted2) !important; }
.ql-picker-label { color: var(--muted2) !important; }

/* ── Grille images ── */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.img-item { background: var(--bg3); border: 2px solid var(--border); border-radius: 8px; overflow: hidden; position: relative; cursor: pointer; transition: border-color 0.15s; }
.img-item:hover, .img-item.selected { border-color: var(--accent); }
.img-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.img-item-footer { padding: 7px 9px; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.img-item-name { font-size: 0.65rem; color: var(--muted2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-delete-btn { background: none; border: none; cursor: pointer; color: var(--danger); opacity: 0; transition: opacity 0.15s; padding: 2px; flex-shrink: 0; }
.img-item:hover .img-delete-btn { opacity: 1; }
.img-item-check { position: absolute; top: 7px; left: 7px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); display: none; align-items: center; justify-content: center; font-size: 0.75rem; color: #fff; font-weight: 700; z-index: 2; }
.img-item.selected .img-item-check { display: flex; }
.upload-zone { border: 2px dashed var(--border2); border-radius: 8px; padding: 32px 20px; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; margin-bottom: 16px; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: rgba(58,104,216,0.05); }
.upload-zone-icon { font-size: 2.2rem; margin-bottom: 8px; opacity: 0.7; }
.upload-zone-text { font-size: 0.82rem; color: var(--muted2); }
.upload-zone-sub  { font-size: 0.7rem; color: var(--muted); margin-top: 4px; }

/* ── Cover preview ── */
.cover-preview { width: 100%; aspect-ratio: 16/7; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: none; }
.cover-preview.visible { display: block; }
/* Focal frame picker */
.focal-picker-container { position: relative; width: 100%; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); user-select: none; }
.focal-picker-container img { display: block; width: 100%; height: auto; pointer-events: none; }
.focal-shade { position: absolute; left: 0; right: 0; background: rgba(0,0,0,.55); pointer-events: none; z-index: 1; }
.focal-frame { position: absolute; left: 0; right: 0; border: 2px dashed rgba(255,255,255,.9); box-sizing: border-box; cursor: grab; z-index: 2; }
.focal-frame:active { cursor: grabbing; }
.focal-frame::after { content: '↕ Glisser'; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: .65rem; color: rgba(255,255,255,.8); background: rgba(0,0,0,.45); padding: 2px 8px; border-radius: 3px; pointer-events: none; white-space: nowrap; }

/* ── Toast ── */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; padding: 12px 20px; border-radius: 8px; font-size: 0.82rem; font-weight: 500; opacity: 0; transform: translateY(8px); transition: all 0.25s; pointer-events: none; max-width: 320px; }
#toast.show { opacity: 1; transform: translateY(0); }
#toast.success { background: #064e3b; color: #6ee7b7; border: 1px solid rgba(16,185,129,0.4); }
#toast.error   { background: #450a0a; color: #fca5a5; border: 1px solid rgba(239,68,68,0.4); }

/* ── Modal ── */
.modal-backdrop { display: none; position: fixed; inset: 0; z-index: 500; background: rgba(0,0,0,0.65); align-items: center; justify-content: center; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; padding: 28px; width: min(520px, 92vw); max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,0.6); }
.modal-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
#img-picker-modal .modal { width: min(860px, 95vw); }
.img-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; max-height: 400px; overflow-y: auto; margin-bottom: 12px; }
.img-picker-item { border: 2px solid var(--border); border-radius: 6px; overflow: hidden; cursor: pointer; transition: border-color 0.15s; }
.img-picker-item:hover { border-color: var(--accent-h); }
.img-picker-item.selected { border-color: var(--accent); }
.img-picker-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }

/* ── Divers ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state-icon { font-size: 2.8rem; margin-bottom: 10px; opacity: 0.5; }
.empty-state-text { font-size: 0.88rem; }
.text-muted  { color: var(--muted); }
.text-danger { color: var(--danger); }
.gap-8 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.thumb-sm { width: 56px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }

/* ── Skill Picker ── */
.ql-skill-insert { color: var(--muted2) !important; }
.ql-skill-insert:hover { color: var(--text) !important; }
.ql-skill-insert svg { vertical-align: middle; }

.skill-picker-modal { width: min(920px, 96vw) !important; max-height: 88vh; display: flex; flex-direction: column; }
.skill-picker-bar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.skill-class-tabs { display: flex; flex-wrap: wrap; gap: 5px; }
.skill-class-btn {
  padding: 4px 11px; border-radius: 4px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--muted2); font-size: 0.7rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s; letter-spacing: 0.05em; text-transform: uppercase;
}
.skill-class-btn:hover { border-color: var(--accent); color: var(--text); }
.skill-class-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.skill-search {
  width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 12px; color: var(--text); font-size: 0.85rem; outline: none;
  transition: border-color 0.15s;
}
.skill-search:focus { border-color: var(--accent); }
.skill-picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 6px; overflow-y: auto; max-height: 420px; padding-right: 4px; flex: 1;
}
.skill-picker-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 4px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg3); cursor: pointer; transition: border-color 0.15s, background 0.15s;
  text-align: center;
}
.skill-picker-item:hover { border-color: var(--accent); background: rgba(58,139,186,0.1); }
.skill-picker-item img { width: 40px; height: 40px; object-fit: contain; }
.skill-picker-item span { font-size: 0.58rem; color: var(--muted2); line-height: 1.3; word-break: break-word; }
.skill-no-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 1.2rem; }
.skill-type-tabs { display: flex; flex-wrap: wrap; gap: 5px; }
.skill-type-btn {
  padding: 4px 11px; border-radius: 4px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--muted2); font-size: 0.7rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s; letter-spacing: 0.05em; text-transform: uppercase;
}
.skill-type-btn:hover { border-color: var(--accent); color: var(--text); }
.skill-type-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.skill-type-btn.type-active.active  { background: #3a8bba; border-color: #3a8bba; }
.skill-type-btn.type-passive.active { background: #22c55e; border-color: #22c55e; }
.skill-type-btn.type-stigma.active  { background: #a855f7; border-color: #a855f7; }
.skill-type-badge {
  font-size: 0.5rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 1px 5px; border-radius: 3px; margin-top: 2px;
}
.skill-type-badge.badge-active  { background: rgba(58,139,186,0.2);  color: #7ab8d8; }
.skill-type-badge.badge-passive { background: rgba(34,197,94,0.2);   color: #6ee7a0; }
.skill-type-badge.badge-stigma  { background: rgba(168,85,247,0.2);  color: #c084fc; }

/* ── Build Planner (embedded in admin form) ── */
.bp-budget {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--bg4); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px 16px; margin-bottom: 14px;
}
.bp-budget-item { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px; }
.bp-budget-label { font-size: 0.68rem; font-weight: 600; color: var(--muted2); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.bp-budget-nums  { font-size: 0.85rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.bp-budget-nums.over { color: var(--danger); }
.bp-sep { color: var(--muted); font-weight: 400; margin: 0 2px; }
.bp-track { flex: 1; height: 5px; background: var(--bg2); border-radius: 3px; overflow: hidden; }
.bp-fill  { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.2s; }
.bp-fill.shard { background: #a855f7; }
.bp-fill.over  { background: var(--danger); }
.bp-section-hdr {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.72rem; font-weight: 700; color: var(--muted2);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin: 12px 0 8px;
}
.bp-count {
  font-size: 0.68rem; background: var(--bg3); border: 1px solid var(--border);
  color: var(--muted); padding: 1px 6px; border-radius: 8px;
}
.bp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px;
}
.bp-card {
  background: var(--bg3); border: 1px solid var(--border2); border-radius: 6px;
  padding: 8px 6px; display: flex; flex-direction: column; align-items: center;
  gap: 4px; text-align: center; transition: border-color 0.15s;
}
.bp-card.has-pts   { border-color: rgba(58,139,186,0.45); }
.bp-card.has-shard { border-color: rgba(168,85,247,0.45); }
.bp-card-icon { width: 36px; height: 36px; object-fit: contain; }
.bp-card-icon-ph { width: 36px; height: 36px; background: var(--bg2); border-radius: 4px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 1.1rem; }
.bp-card-name { font-size: 0.6rem; font-weight: 600; color: var(--text); line-height: 1.3; min-height: 2.4em; display: flex; align-items: center; justify-content: center; }
.bp-dots { display: flex; gap: 2px; justify-content: center; flex-wrap: wrap; }
.bp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--bg2); border: 1px solid var(--border); transition: background 0.1s; }
.bp-dot.filled  { background: var(--accent); border-color: var(--accent); }
.bp-dot.shard   { background: #a855f7; border-color: #a855f7; }
.bp-dot.free    { background: rgba(58,139,186,0.3); border-color: rgba(58,139,186,0.3); }
.bp-dot.daeva   { background: #f59e0b; border-color: #f59e0b; }
.bp-dot.arcana  { background: #a855f7; border-color: #a855f7; }
.bp-ctrl { display: flex; align-items: center; gap: 3px; }
.bp-daeva-badge { font-size: 0.62rem; font-weight: 700; color: #f59e0b; background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.25); border-radius: 4px; padding: 2px 6px; text-align: center; }
.bp-stuff-badge { font-size: 0.62rem; font-weight: 700; color: #34d399; background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.25); border-radius: 4px; padding: 2px 6px; text-align: center; }

/* Daevanion section */
.bp-daeva-grid { display: flex; flex-direction: column; gap: 6px; }
.bp-daeva-row  { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.bp-daeva-name { font-size: 0.72rem; color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-daeva-ctrl { display: flex; gap: 3px; flex-shrink: 0; }
.bp-daeva-btn  { padding: 2px 8px; font-size: 0.68rem; font-weight: 700; background: var(--bg2); border: 1px solid var(--border); border-radius: 4px; color: var(--muted); cursor: pointer; transition: background 0.1s, color 0.1s; }
.bp-daeva-btn.on { background: rgba(245,158,11,0.2); border-color: #f59e0b; color: #f59e0b; }
.bp-daeva-btn:hover { border-color: #f59e0b; color: #f59e0b; }

/* ── Blocs builder ─────────────────────────────────────── */
.bp-block {
  border: 1px solid var(--border2);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}
.bp-block-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(58,139,186,.18) 0%, rgba(58,139,186,.07) 100%);
  border-bottom: 1px solid var(--border2);
  border-left: 3px solid var(--accent);
}
.bp-block-icon { font-size: 1rem; flex-shrink: 0; }
.bp-block-title {
  font-family: 'Cinzel', serif; font-size: 0.8rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text);
}
.bp-block-content {
  padding: 16px;
  background: var(--bg3);
}
.bp-block-note {
  padding: 10px 16px 14px;
  background: rgba(0,0,0,.25);
  border-top: 1px solid var(--border2);
}
.bp-block-note::before {
  content: 'Commentaire';
  display: block;
  font-size: .62rem; font-weight: 600;
  color: var(--muted); letter-spacing: .08em;
  text-transform: uppercase; margin-bottom: 6px;
}
.bp-note-input {
  width: 100%; min-height: 60px; background: var(--bg4);
  border: 1px solid var(--border2); border-radius: 6px;
  color: var(--text); font-size: .8rem; padding: 9px 12px;
  resize: vertical; outline: none; font-family: inherit; line-height: 1.5;
  box-sizing: border-box;
}
.bp-note-input:focus { border-color: rgba(58,139,186,.6); outline: none; }
.bp-note-input::placeholder { color: var(--muted); }
.bp-note-inline { display: block; width: 100%; margin-top: 10px; min-height: 52px; box-sizing: border-box; }

/* Arcana section (legacy) */
.bp-arcana-section { margin-top: 0; padding-top: 0; border-top: none; }
.bp-arcana-section h3 { font-family: 'Cinzel', serif; font-size: 0.85rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text); margin-bottom: 4px; }
.bp-arcana-section p  { font-size: 0.72rem; color: var(--muted); margin-bottom: 16px; }
/* New arcana layout */
.bp-arcana-wrap { display: flex; flex-direction: column; gap: 10px; }
.bp-arcana-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.bp-arcana-card-hdr { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.bp-arcana-card-icon { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 0 5px rgba(168,85,247,0.4)); }
.bp-arcana-card-selects { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bp-arcana-card-hdr .bp-arcana-cardtype,
.bp-arcana-card-hdr .bp-arcana-variant { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 5px; color: var(--text); font-size: 0.72rem; padding: 4px 6px; outline: none; }
.bp-arcana-card-hdr .bp-arcana-cardtype:focus,
.bp-arcana-card-hdr .bp-arcana-variant:focus { border-color: #a855f7; }
.bp-arcana-card-hdr .bp-arcana-rm { padding: 2px 7px; font-size: 0.7rem; color: var(--muted); flex-shrink: 0; }
.bp-arcana-pts { font-size: 0.65rem; font-weight: 700; color: var(--muted); margin-left: auto; flex-shrink: 0; }
.bp-arcana-pts.warn { color: #fbbf24; }
.bp-arcana-pts.full { color: #f87171; }
.bp-arcana-skill-row { display: flex; gap: 6px; align-items: center; }
.bp-arcana-skill-row .bp-arcana-skill { flex: 1; min-width: 0; }
.bp-arcana-skill-row .bp-arcana-bonus { width: 58px; flex-shrink: 0; }
.bp-arcana-skill, .bp-arcana-bonus { background: var(--bg2); border: 1px solid var(--border); border-radius: 5px; color: var(--text); font-size: 0.72rem; padding: 4px 6px; outline: none; }
.bp-arcana-skill:focus, .bp-arcana-bonus:focus { border-color: #a855f7; }
.bp-arcana-add { font-size: 0.72rem; width: 100%; border-style: dashed; color: var(--muted); }
.bp-arcana-add:hover { color: #a855f7; border-color: #a855f7; }
.bp-arcana-badge { font-size: 0.62rem; font-weight: 700; color: #c084fc; background: rgba(168,85,247,0.12); border: 1px solid rgba(168,85,247,0.25); border-radius: 4px; padding: 2px 6px; text-align: center; }
.bp-btn {
  width: 20px; height: 20px; border-radius: 3px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--muted); font-size: 0.85rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.12s; line-height: 1;
}
.bp-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.bp-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.bp-level { font-size: 0.68rem; font-weight: 700; color: var(--text); min-width: 30px; text-align: center; }
.bp-level.max { color: #f9a825; }
.bp-cost { font-size: 0.55rem; color: var(--muted); min-height: 0.9em; }
.bp-cost.has-cost  { color: var(--accent); }
.bp-cost.has-shard { color: #a855f7; }

.bp-chain-row { display: flex; flex-direction: column; gap: 2px; width: 100%; margin-bottom: 2px; }
.bp-chain-group { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; }
.bp-chain-tag { font-size: 0.48rem; font-weight: 600; padding: 1px 5px; border-radius: 3px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.bp-chain-tag.from { background: rgba(168,85,247,0.12); color: #c084fc; border: 1px solid rgba(168,85,247,0.25); }
.bp-chain-tag.to   { background: rgba(58,139,186,0.12); color: #7ab8d8; border: 1px solid rgba(58,139,186,0.25); }

.bp-spec-list { width: 100%; border-top: 1px solid var(--border); margin-top: 5px; padding-top: 5px; display: flex; flex-direction: column; gap: 3px; }
.bp-spec-header { font-size: 0.52rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 3px; display: flex; align-items: center; gap: 5px; }
.bp-spec-slots { font-size: 0.52rem; background: var(--bg2); border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; color: var(--muted); font-weight: 700; }
.bp-spec-slots-full { font-size: 0.52rem; background: rgba(168,85,247,0.15); border: 1px solid rgba(168,85,247,0.4); border-radius: 3px; padding: 0 4px; color: #c084fc; font-weight: 700; }
.bp-spec-item { display: flex; align-items: center; gap: 4px; border-radius: 3px; padding: 1px 2px; transition: background 0.1s; }
.bp-spec-item:not(.locked):hover { background: rgba(255,255,255,0.04); }
.bp-spec-item.selected { background: rgba(255,255,255,0.06); }
.bp-spec-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; border: 1.5px solid; background: transparent; }
.bp-spec-item.selected .bp-spec-dot { }
.bp-spec-text { font-size: 0.55rem; color: var(--text); line-height: 1.3; }
.bp-spec-item:not(.selected):not(.locked) .bp-spec-text { color: var(--muted); }
.bp-spec-lv { font-size: 0.52rem; color: var(--muted2); opacity: 0.7; }
.bp-spec-item.locked { opacity: 0.45; }

/* ── Stuff editor ── */
.bp-stuff-item { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--bg2); margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; }
.bp-stuff-header { display: flex; align-items: center; gap: 8px; }
.bp-stuff-inputs { display: grid; grid-template-columns: 1fr; gap: 6px; }
.bp-stuff-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bp-stuff-col { display: flex; flex-direction: column; gap: 3px; }
.bp-stuff-col-title { font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.bp-stuff-col-title.add { color: #b8a040; }
.bp-stuff-col-title.ms  { color: #a855f7; }
.bp-stuff-stat-row { display: flex; align-items: center; gap: 4px; border-radius: 4px; transition: box-shadow .15s; }
.bp-stuff-stat-row.ms-prio  { box-shadow: inset 2px 0 0 #c9a227, inset 0 0 0 1px rgba(201,162,39,.35); background: rgba(201,162,39,.06); }
.bp-stuff-stat-row.add-prio { box-shadow: inset 2px 0 0 #b8a040, inset 0 0 0 1px rgba(184,160,64,.35); background: rgba(184,160,64,.06); }
.bp-stuff-stat-input { flex: 1; min-width: 0; background: var(--bg3); border: 1px solid var(--border); border-radius: 4px; padding: 3px 6px; color: var(--text); font-size: .72rem; outline: none; }
.bp-stuff-stat-input:focus { border-color: var(--accent); }
.bp-ms-star { background: none; border: none; cursor: pointer; font-size: .85rem; color: var(--muted); padding: 0 2px; line-height: 1; transition: color .15s, transform .1s; flex-shrink: 0; }
.bp-ms-star:hover { color: #c9a227; transform: scale(1.2); }
.bp-ms-star.on { color: #c9a227; }
/* Icône de sort dans les additionnelles */
.bp-stuff-skill-ico { width: 24px; height: 24px; object-fit: contain; border-radius: 4px; background: var(--bg2); border: 1px solid var(--border); flex-shrink: 0; }
.bp-stuff-skill-sel { flex-shrink: 0; max-width: 170px; font-size: 0.72rem; padding: 2px 4px; background: var(--bg2); color: var(--text); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; }

/* ── Macro ── */
.bp-macro-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.bp-macro-row:last-child { border-bottom: none; }
.bp-macro-num { width: 20px; text-align: center; font-size: 1rem; color: var(--muted); font-weight: 600; flex-shrink: 0; }
.bp-macro-skill { flex-shrink: 0; }
.bp-macro-info { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.bp-macro-name { font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-macro-delay { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--muted); }
.bp-macro-delay label { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }

/* ── Action Bar Grid ── */
.ab-scroll { overflow-x: auto; padding-bottom: 4px; margin-top: 12px; }
.ab-wrap { width: max-content; margin: 0 auto; user-select: none; }
.ab-row { display: flex; gap: 4px; margin-bottom: 4px; align-items: center; }
.ab-row-label { font-size: 0.62rem; font-weight: 700; color: var(--muted); min-width: 18px; text-align: left; padding-left: 8px; flex-shrink: 0; }
.ab-separator { border-top: 2px solid rgba(255,255,255,0.12); margin: 10px 0; }
.ab-col-sep { width: 10px; flex-shrink: 0; border-left: 1px solid rgba(255,255,255,0.07); align-self: stretch; margin: 0 2px; }
.ab-hotbar .ab-cell { border-color: rgba(145,71,255,0.25); background: rgba(145,71,255,0.04); }
.ab-hotbar .ab-cell:hover { border-color: #9147ff; background: rgba(145,71,255,0.15); }
.ab-col-labels { gap: 4px; margin-top: 2px; }
.ab-col-label { width: 46px; text-align: center; font-size: 0.58rem; font-weight: 600; color: var(--muted); flex-shrink: 0; }
/* Ligne miroir */
.ab-mirror-row { margin-bottom: 8px; opacity: 0.5; }
.ab-mirror-cell { cursor: default !important; filter: grayscale(45%); border-style: dashed !important; }
.ab-mirror-cell:hover { border-color: rgba(255,255,255,0.07) !important; background: rgba(255,255,255,0.02) !important; }
.ab-cell {
  width: 46px; height: 46px; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 5px;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: border-color 0.14s, background 0.14s;
  overflow: hidden;
}
.ab-cell:hover { border-color: var(--accent); background: rgba(58,139,186,0.1); }
.ab-cell[draggable="true"] { cursor: grab; }
.ab-cell[draggable="true"]:active { cursor: grabbing; }
.ab-cell.ab-dragging { opacity: .4; }
.ab-cell.ab-drag-over { border-color: #c9a227 !important; background: rgba(201,162,39,.15) !important; }
.ab-cell-empty { font-size: 1.1rem; color: rgba(255,255,255,0.1); line-height: 1; pointer-events: none; }
.ab-cell-filled img { width: 40px; height: 40px; object-fit: contain; border-radius: 3px; display: block; pointer-events: none; }
.ab-cell-ph { font-size: 1.1rem; pointer-events: none; }
.ab-cell-lv {
  position: absolute; bottom: 1px; right: 2px;
  font-size: 0.5rem; font-weight: 700; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000;
  pointer-events: none; line-height: 1;
}

/* Action bar slot picker modal */
.ab-picker-search-wrap { padding-bottom: 12px; }
.ab-picker-search-wrap input { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; color: var(--text); font-size: 0.82rem; outline: none; transition: border-color 0.14s; }
.ab-picker-search-wrap input:focus { border-color: var(--accent); }
.ab-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 7px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 4px;
}
.ab-skill-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px 6px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; transition: border-color 0.12s, background 0.12s;
  text-align: center;
}
.ab-skill-item:hover { border-color: var(--accent); background: rgba(58,139,186,0.08); }
.ab-skill-item img { width: 36px; height: 36px; object-fit: contain; border-radius: 3px; display: block; }
.ab-ph { font-size: 1.2rem; }
.ab-skill-name { font-size: 0.55rem; color: var(--muted2); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; max-width: 100%; }

/* ── Wheel editor ──────────────────────────────────────── */
.bp-wheel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
.bp-wheel-group { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.bp-wheel-group-title { font-size: .7rem; font-weight: 700; color: #a855f7; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; }
.bp-wheel-inputs { display: flex; flex-direction: column; gap: 5px; }
.bp-wheel-row { display: flex; align-items: center; gap: 8px; }
.bp-wheel-icon { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
.bp-wheel-label { flex: 1; font-size: .72rem; color: var(--text); }
.bp-wheel-input { width: 70px; background: var(--bg2); border: 1px solid var(--border); border-radius: 5px; color: var(--text); font-size: .72rem; padding: 3px 6px; outline: none; text-align: right; }
.bp-wheel-input:focus { border-color: #a855f7; }
@media (max-width: 600px) { .bp-wheel-grid { grid-template-columns: 1fr; } }
.bp-cs-label { margin-left:auto; display:flex; align-items:center; gap:5px; font-size:.68rem; font-weight:400; color:var(--muted); text-transform:none; letter-spacing:0; cursor:pointer; }
.bp-cs-label input[type=checkbox] { accent-color:var(--accent); cursor:pointer; }

/* ════════════════════════════════════════════════════════
   RESPONSIVE MOBILE — admin utilisable sur téléphone
   Le sidebar devient un tiroir (drawer) qu'on ouvre via le
   bouton hamburger du topbar ; le reste s'empile en 1 colonne.
════════════════════════════════════════════════════════ */
.sidebar-toggle { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 6px; margin-right: 4px; flex-shrink: 0; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 99; }

@media (max-width: 860px) {
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
    width: 260px;
    z-index: 200;
  }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,.5); }
  body.sidebar-open .sidebar-backdrop { display: block; }

  .main-area { margin-left: 0; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-title { font-size: .88rem; }
  .content { padding: 14px; }

  /* Grilles à 2 colonnes ou plus -> 1 colonne */
  .form-grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .img-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .img-picker-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); max-height: 280px; }
  .bp-stuff-cols { grid-template-columns: 1fr; }

  /* Tables : scroll horizontal plutôt que contenu tronqué */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }

  /* En-têtes de table avec filtre : on empile au lieu de forcer sur une ligne */
  .table-header { flex-wrap: wrap; gap: 8px; align-items: flex-start; }
  .table-header > select,
  .table-header .gap-8 { width: 100%; }
  .table-header .gap-8 > select { flex: 1; min-width: 0; }

  /* Formulaires : boutons empilés et pleine largeur, plus faciles à toucher */
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1; min-width: 120px; }

  /* Modales : moins de padding pour laisser de la place au contenu */
  .modal { padding: 18px; width: 94vw; }

  /* Cartes de stats du dashboard : texte un peu plus compact */
  .stat-val { font-size: 1.3rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .td-actions { flex-wrap: wrap; }
}
