.mbd-root,
.mbd-root *{
  box-sizing: border-box; /* ✅ FIX débordement */
}

.mbd-root{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  max-width: 100%;
}

.mbd-topbar{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #2f2f2f;
}

.mbd-title{
  flex: 1;
  text-align: center;
  color: #fff;
  font-weight: 700;
  letter-spacing: .2px;
  opacity: .95;
  white-space: nowrap;
}

.mbd-btn{
  background: #111827;
  color: #fff;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}
.mbd-btn:hover{ filter: brightness(1.08); }

.mbd-body{
  display: flex;
  min-height: 420px;
}

.mbd-sidebar{
  width: 280px;
  min-width: 0;
  border-right: 1px solid #e5e7eb;
  padding: 12px;
  background: #fafafa;
}

.mbd-card{
  min-width: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 1px rgba(0,0,0,.03);
}

.mbd-card-title{
  font-weight: 900;
  font-size: 13px;
  text-transform: uppercase;
  color: #111827;
  margin-bottom: 10px;
  letter-spacing: .3px;
}

.mbd-label{
  display: block;
  font-size: 12px;
  color: #374151;
  margin: 8px 0 6px;
}

.mbd-field-row{
  display: flex;
  align-items: center;
  gap: 8px;
}

.mbd-input{
  width: 100%;
  max-width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px;
  font-size: 14px;
  background: #fff;
}

.mbd-input[disabled]{
  background: #f3f4f6;
  color: #6b7280;
  cursor: not-allowed;
}

.mbd-suffix{
  white-space: nowrap;
  font-weight: 700;
  color: #6b7280;
}

.mbd-muted{
  color: #6b7280;
  font-size: 12px;
}

.mbd-hint{
  margin-top: 10px;
  line-height: 1.35;
}

.mbd-kv{
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed #e5e7eb;
}
.mbd-kv:last-child{ border-bottom: 0; }

.mbd-canvas-wrap{
  flex: 1;
  position: relative;
  background: #fff;
  min-height: 320px;
}

.mbd-canvas{ display: block; }

/* ===== Rosace ===== */
.mbd-rosace{
  position: relative;
  width: 160px;
  height: 160px;
  margin-top: 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: radial-gradient(circle at center, #ffffff 0%, #fafafa 70%);
  display: grid;
  place-items: center;
}

.mbd-rosace-center{
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #111827;
  box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.mbd-dot{
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: #2563eb;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.mbd-dot:hover{ filter: brightness(1.1); }

.mbd-dot[data-angle="90"]   { top: 10px; left: 50%; transform: translateX(-50%); }
.mbd-dot[data-angle="135"]  { top: 26px; right: 26px; }
.mbd-dot[data-angle="180"]  { top: 50%; right: 10px; transform: translateY(-50%); }
.mbd-dot[data-angle="-135"] { bottom: 26px; right: 26px; }
.mbd-dot[data-angle="-90"]  { bottom: 10px; left: 50%; transform: translateX(-50%); }
.mbd-dot[data-angle="-45"]  { bottom: 26px; left: 26px; }
.mbd-dot[data-angle="0"]    { top: 50%; left: 10px; transform: translateY(-50%); }
.mbd-dot[data-angle="45"]   { top: 26px; left: 26px; }

.mbd-rosace.is-disabled{
  opacity: .5;
  pointer-events: none;
}

/* ===== Responsive ===== */
@media (max-width: 960px){
  .mbd-body{ flex-direction: column; }
  .mbd-sidebar{
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .mbd-card{ margin-bottom: 0; }
}

@media (max-width: 640px){
  .mbd-topbar{ flex-wrap: wrap; }
  .mbd-title{
    flex: 1 1 100%;
    order: -1;
    white-space: normal;
  }
  .mbd-btn{ flex: 1 1 100%; width: 100%; }
  .mbd-sidebar{ grid-template-columns: 1fr; }
}

.mbd-canvas-wrap{
  position: relative;
}

.mbd-canvas{
  touch-action: none; /* important pour pointer events */
}

.mbd-canvas-tools{
  position:absolute;
  right:12px;
  bottom:12px;
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px;
  border-radius:14px;
  background: rgba(17,24,39,.72);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}

.mbd-tool{
  width:36px;
  height:36px;
  border-radius:10px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color:#fff;
  font-size:18px;
  font-weight:700;
  line-height:1;
  cursor:pointer;
}

.mbd-tool:hover{
  background: rgba(255,255,255,.14);
}

.mbd-zoom{
  min-width:54px;
  text-align:center;
  color:#fff;
  font-weight:600;
  font-size:13px;
  opacity:.92;
  user-select:none;
}

.mbd-btn-danger{
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(239,68,68,.35);
  background: rgba(239,68,68,.10);
  color: #b91c1c;
  font-weight: 700;
  cursor: pointer;
}
.mbd-btn-danger:hover{
  background: rgba(239,68,68,.16);
}

.mbd-hint--warning{
  color:#b91c1c !important;
  font-weight:700;
}

.mbd-top-actions{
  display:flex;
  gap:8px;
  align-items:center;
}

.mbd-btn{
  height:40px;
  min-width:44px;
  padding:0 12px;
  border-radius:12px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color:#fff;
  font-weight:800;
  cursor:pointer;
}
.mbd-btn:hover{ background: rgba(255,255,255,.12); }
.mbd-btn:disabled{
  opacity:.45;
  cursor:not-allowed;
}

.mbd-btn-danger:disabled{
  opacity: .45;
  cursor: not-allowed;
}